All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar" <aneesh.kumar@gmail.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Oleg Nesterov" <oleg@tv-sign.ru>,
	"Srivatsa Vaddagiri" <vatsa@in.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@osdl.org>, "Pavel Machek" <pavel@ucw.cz>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	"Gautham R Shenoy" <ego@in.ibm.com>
Subject: Re: [RFC][PATCH 1/3] Freezer: Fix vfork problem
Date: Tue, 27 Feb 2007 10:03:53 +0530	[thread overview]
Message-ID: <cc723f590702262033k4fa6cbe0n8e327b8339c7a0e4@mail.gmail.com> (raw)
In-Reply-To: <200702270131.25656.rjw@sisk.pl>

>   * Only the _current_ task can read/write to tsk->flags, but other
> Index: linux-2.6.20-mm2/include/linux/freezer.h
> ===================================================================
> --- linux-2.6.20-mm2.orig/include/linux/freezer.h       2007-02-26 08:40:22.000000000 +0100
> +++ linux-2.6.20-mm2/include/linux/freezer.h    2007-02-27 00:51:44.000000000 +0100
> @@ -75,7 +75,32 @@ static inline int try_to_freeze(void)
>                 return 0;
>  }
>
> -extern void thaw_some_processes(int all);
> +/*
> + * Tell the freezer not to count current task as freezeable
> + */
> +static inline void freezer_do_not_count(void)
> +{
> +       current->flags |= PF_FREEZER_SKIP;
> +}
> +
> +/*
> + * Tell the freezer to count this task as freezeable again and if it's a user
> + * space one, try to freeze it
> + */
> +static inline void freezer_count(void)
> +{
> +       current->flags &= ~PF_FREEZER_SKIP;
> +       if (current->mm)
> +               try_to_freeze();
> +}
> +


This means that we are not going to wait for the kernel thread
(Parent) to freeze. I guess what vatsa suggested in previous mail is
better.

freeezer_do_not_count(void)
{
   if (current->mm) {

       current->flags |= PF_FREEZER_SKIP;
   }

}


freezer_count(void)
{
 if (current->mm) {
current->flags &= ~PF_FREEZER_SKIP;
try_to_freeze();
   }

}


Now if do_fork is called from kernel_thread with CLONE_VFORK we make
the freezer wait till that kernel thread is also frozen. I think this
is important.  with khelper thread it is okey because it is a single
threaded workqueue.

If do_fork is called via a user process we can skip the Parent if the
child got frozen before calling execve.

-aneesh

  reply	other threads:[~2007-02-27  4:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-26 10:39 [RFC][PATCH 0/3] More freezer patches Rafael J. Wysocki
2007-02-26 10:47 ` [RFC][PATCH 1/3] Freezer: Fix vfork problem Rafael J. Wysocki
2007-02-26 12:00   ` Oleg Nesterov
2007-02-26 15:14     ` Srivatsa Vaddagiri
2007-02-26 16:11       ` Oleg Nesterov
2007-02-26 18:28         ` Rafael J. Wysocki
2007-02-26 21:25           ` Oleg Nesterov
2007-02-27  0:31             ` Rafael J. Wysocki
2007-02-27  4:33               ` Aneesh Kumar [this message]
2007-02-27  4:42                 ` Srivatsa Vaddagiri
2007-02-27  8:37                 ` Oleg Nesterov
2007-02-27 21:21                   ` Rafael J. Wysocki
2007-02-27 21:53                     ` Oleg Nesterov
2007-02-28  1:23                       ` Srivatsa Vaddagiri
2007-02-28 10:57                         ` Rafael J. Wysocki
2007-02-28 11:00                           ` Oleg Nesterov
2007-02-28 19:36                             ` Rafael J. Wysocki
2007-02-28 20:30                               ` Oleg Nesterov
2007-02-28 22:34                                 ` Rafael J. Wysocki
2007-02-28 11:01                           ` Srivatsa Vaddagiri
2007-02-26 10:49 ` [RFC][PATCH 2/3] Freezer: Take kernel_execve into consideration Rafael J. Wysocki
2007-02-26 12:45   ` Pavel Machek
2007-02-26 10:52 ` [RFC][PATCH 3/3] Freezer: Prevent ___call_usermodehelper from missing freezing requests Rafael J. Wysocki
2007-02-26 11:52   ` Oleg Nesterov
2007-02-26 11:58   ` Aneesh Kumar
2007-02-26 18:30     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc723f590702262033k4fa6cbe0n8e327b8339c7a0e4@mail.gmail.com \
    --to=aneesh.kumar@gmail.com \
    --cc=akpm@osdl.org \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=vatsa@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.