lkml.org 
[lkml]   [2007]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH -mm 2/3] freezer: Introduce freezer_flags
Date
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-23 22:05    [W:0.063 / U:2.676 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site