[PATCH -mm] freezer: Document task_lock in thaw_process

From: Rafael J. Wysocki
Date: Fri Apr 20 2007 - 18:20:08 EST


From: Rafael J. Wysocki <rjw@xxxxxxx>

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 <rjw@xxxxxxx>
---
include/linux/freezer.h | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-2.6.21-rc6-mm1/include/linux/freezer.h
===================================================================
--- linux-2.6.21-rc6-mm1.orig/include/linux/freezer.h 2007-04-09 15:24:25.000000000 +0200
+++ linux-2.6.21-rc6-mm1/include/linux/freezer.h 2007-04-21 00:17:30.000000000 +0200
@@ -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)
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/