Re: [RFC][PATCH -mm 2/3] freezer: Introduce freezer_flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, 23 April 2007 16:19, Gautham R Shenoy wrote:
> Hi Satyam, 
> On Mon, Apr 23, 2007 at 09:39:30AM +0530, Satyam Sharma wrote:
> > Hi Rafael,
> > 
> > >+/*
> > >+ *     Per task flags used by the freezer
> > >+ *
> > >+ *     They should not be referred to directly outside of this file.
> > >+ */
> > >+#define TFF_NOFREEZE   0       /* task should not be frozen */
> > >+#define TFF_FREEZE     8       /* task should go to the refrigerator ASAP 
> > >*/
> > >+#define TFF_SKIP       9       /* do not count this task as freezable */
> > >+#define TFF_FROZEN     10      /* task is frozen */
> > 
> > Aren't NOFREEZE and SKIP doing the same thing? One of them appears
> > superfluous. I'm looking at 21-rc6-mm1 and vfork(2) seems to be its
> > only user. Seeing how vfork(2) used it, can't the call to
> > freezer_do_not_count() be replaced with a call to freezer_exempt()?
> > Similarly, the freezer_count() after the wait_for_completion might
> > just as well be a clear of the NOFREEZE bit followed by a
> > try_to_freeze(). Could you please explain the rationale behind the
> > SKIP flag?
> 
> The difference between the NOFREEZE and the SKIP flag is a subtle one.
> 
> When a task (say p) sets it's NOFREEZE flag, it tells the freezer not to
> consider it for freezing. Which means freezeable(p) will return 0.
> So the freezer will not even mark it for freezing. 
> 
> However, when a task sets it SKIP flag, it tells the freezer - "I might
> block at a safe place. So when you are counting the processes which
> have been marked as freezeable, but have not frozen yet, please don't
> count me in. IOW, please skip me."  
> Thus such a task can still be marked for freezing.
> 
> The typical usage is 
> freezer_do_not_count(current);
> /* currents goes to an uninterruptible sleep, like wait_for_completion. */
> freezer_count(current);
> 
> Once the task wakes up from it's uninterruptible sleep, it will 
> call freezer_count which in turn calls try_to_freeze.
> If the task was marked for freezing, it will be frozen now.
> 
> You may want to check the thread http://lkml.org/lkml/2007/2/18/47 
> on how it came into existance.

Very well explained.  Thanks!

Greetings,
Rafael

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux