Skip to contentSkip to conversation

freezer: Document task_lock in thaw_process

PATCH In review Rafael J. Wysocki 2 participants 2 messages Apr 20, 2007 – Apr 21, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 freezer: Document task_lock in thaw_process

From: Rafael J. Wysocki <[email protected]>

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.

---
 include/linux/freezer.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/linux/freezer.h +6 -0
Index: linux-2.6.21-rc6-mm1/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)
 {
#1 lore raw
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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.

ACK.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html