mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-01 11:54:10 +00:00
freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks
clear_freeze_flag() in exit_mm() is racy. Freezing can start afterwards. Remove it. Skipping freezer for exiting task will be properly implemented later. Also, freezable() was testing exit_state directly to make system freezer ignore dead tasks. Let the exiting task set PF_NOFREEZE after entering TASK_DEAD instead. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com>
This commit is contained in:
parent
a5be2d0d1a
commit
a585042f7b
2 changed files with 2 additions and 4 deletions
|
@ -679,8 +679,6 @@ static void exit_mm(struct task_struct * tsk)
|
||||||
tsk->mm = NULL;
|
tsk->mm = NULL;
|
||||||
up_read(&mm->mmap_sem);
|
up_read(&mm->mmap_sem);
|
||||||
enter_lazy_tlb(mm, current);
|
enter_lazy_tlb(mm, current);
|
||||||
/* We don't want this task to be frozen prematurely */
|
|
||||||
clear_freeze_flag(tsk);
|
|
||||||
task_unlock(tsk);
|
task_unlock(tsk);
|
||||||
mm_update_next_owner(mm);
|
mm_update_next_owner(mm);
|
||||||
mmput(mm);
|
mmput(mm);
|
||||||
|
@ -1040,6 +1038,7 @@ NORET_TYPE void do_exit(long code)
|
||||||
exit_rcu();
|
exit_rcu();
|
||||||
/* causes final put_task_struct in finish_task_switch(). */
|
/* causes final put_task_struct in finish_task_switch(). */
|
||||||
tsk->state = TASK_DEAD;
|
tsk->state = TASK_DEAD;
|
||||||
|
tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */
|
||||||
schedule();
|
schedule();
|
||||||
BUG();
|
BUG();
|
||||||
/* Avoid "noreturn function does return". */
|
/* Avoid "noreturn function does return". */
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
static inline int freezable(struct task_struct * p)
|
static inline int freezable(struct task_struct * p)
|
||||||
{
|
{
|
||||||
if ((p == current) ||
|
if ((p == current) ||
|
||||||
(p->flags & PF_NOFREEZE) ||
|
(p->flags & PF_NOFREEZE))
|
||||||
(p->exit_state != 0))
|
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue