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:
@@ -425,7 +425,7 @@ static int memcg_charge_kernel_stack(struct task_struct *tsk)
|
||||
|
||||
static void release_task_stack(struct task_struct *tsk)
|
||||
{
|
||||
if (WARN_ON(tsk->state != TASK_DEAD))
|
||||
if (WARN_ON(READ_ONCE(tsk->__state) != TASK_DEAD))
|
||||
return; /* Better to leak the stack than to free prematurely */
|
||||
|
||||
account_kernel_stack(tsk, -1);
|
||||
@@ -2392,7 +2392,7 @@ bad_fork_cleanup_count:
|
||||
atomic_dec(&p->cred->user->processes);
|
||||
exit_creds(p);
|
||||
bad_fork_free:
|
||||
p->state = TASK_DEAD;
|
||||
WRITE_ONCE(p->__state, TASK_DEAD);
|
||||
put_task_stack(p);
|
||||
delayed_free_task(p);
|
||||
fork_out:
|
||||
|
||||
Reference in New Issue
Block a user