sched: Change task_struct::state
Change the type and name of task_struct::state. Drop the volatile and shrink it to an 'unsigned int'. Rename it in order to find all uses such that we can use READ_ONCE/WRITE_ONCE as appropriate. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com> Acked-by: Will Deacon <will@kernel.org> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20210611082838.550736351@infradead.org
This commit is contained in:
@@ -1537,7 +1537,8 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
|
||||
{
|
||||
const struct cred *cred;
|
||||
unsigned int i, len;
|
||||
|
||||
unsigned int state;
|
||||
|
||||
/* first copy the parameters from user space */
|
||||
memset(psinfo, 0, sizeof(struct elf_prpsinfo));
|
||||
|
||||
@@ -1559,7 +1560,8 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
|
||||
psinfo->pr_pgrp = task_pgrp_vnr(p);
|
||||
psinfo->pr_sid = task_session_vnr(p);
|
||||
|
||||
i = p->state ? ffz(~p->state) + 1 : 0;
|
||||
state = READ_ONCE(p->__state);
|
||||
i = state ? ffz(~state) + 1 : 0;
|
||||
psinfo->pr_state = i;
|
||||
psinfo->pr_sname = (i > 5) ? '.' : "RSDTZW"[i];
|
||||
psinfo->pr_zomb = psinfo->pr_sname == 'Z';
|
||||
@@ -1571,7 +1573,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
|
||||
SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid));
|
||||
rcu_read_unlock();
|
||||
strncpy(psinfo->pr_fname, p->comm, sizeof(psinfo->pr_fname));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user