LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Oleg Nesterov <oleg@tv-sign.ru>, Pavel Machek <pavel@ucw.cz>
Cc: Aneesh Kumar <aneesh.kumar@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	paulmck@linux.vnet.ibm.com, ego@in.ibm.com, akpm@osdl.org,
	mingo@elte.hu, vatsa@in.ibm.com, dipankar@in.ibm.com,
	venkatesh.pallipadi@intel.com
Subject: Re: [RFC][PATCH 4/7] Freezer: Fix vfork problem
Date: Sun, 25 Feb 2007 21:33:37 +0100	[thread overview]
Message-ID: <200702252133.39011.rjw@sisk.pl> (raw)
In-Reply-To: <20070225203154.GA2276@tv-sign.ru>

On Sunday, 25 February 2007 21:31, Oleg Nesterov wrote:
> On 02/25, Rafael J. Wysocki wrote:
> >
> > On Sunday, 25 February 2007 16:40, Aneesh Kumar wrote:
> > > On 2/25/07, Aneesh Kumar <aneesh.kumar@gmail.com> wrote:
> > > > On 2/25/07, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > > > > On Sunday, 25 February 2007 15:33, Aneesh Kumar wrote:
> > > > > > On 2/25/07, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > [--snip--]
> > > 
> > > Thinking about this  i guess we have a problem with the above approach
> > > i outlined. if we have one task that is waiting on the event and more
> > > than one that can generate the event then the above logic would not
> > > work. Also with cases other than vfork; logic of tracking the waiting
> > > task gets complex. I guess what we have right now is better.
> > 
> > I assume by "righ now" you mean the latest version of my patch. ;-)
> > 
> > Still, having pondered the Pavel's suggestion for a while I think it's doable
> > without the addtitional process flag.  Patch below.
> 
> Probably I missed something, (I didn't see this patch and I missed the
> start of discussion), but I can't understand this patch.

Please see http://lkml.org/lkml/2007/2/25/53 .

> > +__wait_for_completion(struct completion *x, int freezable)
> >  {
> >  	might_sleep();
> >  
> > @@ -3817,6 +3818,9 @@ void fastcall __sched wait_for_completio
> >  			__set_current_state(TASK_UNINTERRUPTIBLE);
> >  			spin_unlock_irq(&x->wait.lock);
> >  			schedule();
> > +			if (freezable)
> > +				try_to_freeze();
> > +
> >  			spin_lock_irq(&x->wait.lock);
> >  		} while (!x->done);
> >  		__remove_wait_queue(&x->wait, &wait);
> > @@ -3824,7 +3828,7 @@ void fastcall __sched wait_for_completio
> >  	x->done--;
> >  	spin_unlock_irq(&x->wait.lock);
> >  }
> >
> > ..........
> >
> > @@ -48,6 +48,9 @@ void refrigerator(void)
> >  		task_unlock(current);
> >  		return;
> >  	}
> > +	if (current->vfork_done)
> > +		wake_up_process(current->parent);
> > +
> 
> What if current->parent doesn't have TIF_FREEZE yet? ->parent will schedule()
> again, child goes to refrigerator. Now, how can we freeze the ->parent?

Good point.  I didn't think about it.

All in all, having tried some different approaches I think that the patch at
http://lkml.org/lkml/2007/2/25/80 is the right thing to do.

Pavel, do you agree?

Rafael

  reply	other threads:[~2007-02-25 20:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 10:16 [RFC][PATCH 0/7] Freezer: Hardening and preparation for CPU hotplug changes Rafael J. Wysocki
2007-02-23 10:18 ` [RFC][PATCH 1/7] Freezer: Read PF_BORROWED_MM in a nonracy way Rafael J. Wysocki
2007-02-25 10:43   ` Pavel Machek
2007-02-23 10:19 ` [RFC][PATCH 2/7] Freezer: Fix memory ordering in refrigerator Rafael J. Wysocki
2007-02-23 10:21 ` [RFC][PATCH 3/7] Freezer: Close theoretical race between refrigerator and thaw_tasks Rafael J. Wysocki
2007-02-25 10:44   ` Pavel Machek
2007-02-23 10:22 ` [RFC][PATCH 4/7] Freezer: Fix vfork problem Rafael J. Wysocki
2007-02-25 10:46   ` Pavel Machek
2007-02-25 10:45     ` Rafael J. Wysocki
2007-02-25 12:59       ` Rafael J. Wysocki
2007-02-25 14:33         ` Aneesh Kumar
2007-02-25 15:05           ` Rafael J. Wysocki
2007-02-25 15:28             ` Aneesh Kumar
2007-02-25 15:40               ` Aneesh Kumar
2007-02-25 19:17                 ` Rafael J. Wysocki
2007-02-25 20:31                   ` Oleg Nesterov
2007-02-25 20:33                     ` Rafael J. Wysocki [this message]
2007-02-25 13:01     ` Aneesh Kumar
2007-02-25 13:43       ` Rafael J. Wysocki
2007-02-23 10:23 ` [RFC][PATCH 5/7] Freezer: Remove PF_NOFREEZE from rcutorture thread Rafael J. Wysocki
2007-02-25 10:44   ` Pavel Machek
2007-02-23 10:25 ` [RFC][PATCH 6/7] Freezer: Remove PF_NOFREEZE from bluetooth threads Rafael J. Wysocki
2007-02-25 10:44   ` Pavel Machek
2007-02-25 23:53   ` Marcel Holtmann
2007-02-23 10:26 ` [RFC][PATCH 7/7] Freezer: Add try_to_freeze calls to all kernel threads Rafael J. Wysocki
2007-02-25 10:45   ` Pavel Machek

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=200702252133.39011.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=aneesh.kumar@gmail.com \
    --cc=dipankar@in.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pavel@ucw.cz \
    --cc=vatsa@in.ibm.com \
    --cc=venkatesh.pallipadi@intel.com \
    --subject='Re: [RFC][PATCH 4/7] Freezer: Fix vfork problem' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).