From: Rafael J. Wysocki The task_lock() in include/linux/freezer.h:thaw_process() looks as though it were protecting p->flags, which is not the case. Add a comment that explains why it's there. Signed-off-by: Rafael J. Wysocki Cc: Gautham R Shenoy Cc: Oleg Nesterov Signed-off-by: Andrew Morton --- include/linux/freezer.h | 6 ++++++ 1 files changed, 6 insertions(+) diff -puN include/linux/freezer.h~freezer-document-task_lock-in-thaw_process include/linux/freezer.h --- a/include/linux/freezer.h~freezer-document-task_lock-in-thaw_process +++ a/include/linux/freezer.h @@ -37,6 +37,12 @@ static inline void do_not_freeze(struct /* * Wake up a frozen process + * + * task_lock() is taken to prevent the race with refrigerator() which may + * occur if the freezing of tasks fails. Namely, without the lock, if the + * freezing of tasks failed, thaw_tasks() might have run before a task in + * refrigerator() could call frozen_process(), in which case the task would be + * frozen and no one would thaw it. */ static inline int thaw_process(struct task_struct *p) { _