mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm] freezer: Document task_lock in thaw_process
@ 2007-04-20 22:23 Rafael J. Wysocki
  2007-04-21  8:55 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2007-04-20 22:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Oleg Nesterov, Pavel Machek

From: Rafael J. Wysocki <rjw@sisk.pl>

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@sisk.pl>
---
 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)
 {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -mm] freezer: Document task_lock in thaw_process
  2007-04-20 22:23 [PATCH -mm] freezer: Document task_lock in thaw_process Rafael J. Wysocki
@ 2007-04-21  8:55 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2007-04-21  8:55 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Andrew Morton, LKML, Oleg Nesterov

On Sat 2007-04-21 00:23:19, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> 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@sisk.pl>

ACK.
									Pavel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-21  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-20 22:23 [PATCH -mm] freezer: Document task_lock in thaw_process Rafael J. Wysocki
2007-04-21  8:55 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®