[lkml]   [2012]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2 2/4] PM/Freezer: Make thaw_processes() thaw only userspace tasks
On 01/31/2012 05:00 AM, Tejun Heo wrote:

> On Tue, Jan 31, 2012 at 04:44:48AM +0530, Srivatsa S. Bhat wrote:
>> Currently the situation is:
>> freeze_processes() - freezes only userspace tasks
>> freeze_kernel_threads() - freezes only kernel threads
>> thaw_kernel_threads() - thaws only kernel threads
>> thaw_processes() - thaws *everything* (both userspace tasks and kernel threads)
> Umm... I don't really get this. Why is this a problem? The list is
> not even correct. freeze_kernel_threads() doesn't freeze "only"
> kernel threads. It freezes all threads "including" kernel threads and

Oh, you are are right - the list is incorrect. I guess I got carried away
thinking about thaw_kernel_threads().

> that's only natural because you can't freeze kernel threads without
> freezing userland threads and of course you can't thaw userland
> threads without thawing kernel threads.

> The system simply won't work if you do it otherwise and making them

> disjoint operations increases the chance of bugs. These operations
> are naturally enclosed within each other and trying to break them
> apart isn't a good idea.

Yeah, I get it now.. Thanks for the explanation!

> What's the problem you're trying to solve here? I don't really see
> code clean up. Code is different but not necessarily cleaner and FWIW
> it seems more unnatural and brittle to me.

The thing is that, I wanted to avoid a bug in the patch posted at as explained in the link.

So I guess I should have simply done:

freeze_kernel_threads() calls thaw_kernel_threads() upon error.
The caller of freeze_kernel_threads() will call thaw_processes() if

This way even the SNAPSHOT_CREATE_IMAGE ioctl would remain safe.

I'll think it through again and post an updated patch.
Thank you very much for the review!

Srivatsa S. Bhat

 \ /
  Last update: 2012-01-31 01:11    [W:0.043 / U:4.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site