linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jeff Layton <jlayton@redhat.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Steve French <sfrench@samba.org>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-cifs@vger.kernel.org,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Neil Brown <neilb@suse.de>,
	trond.myklebust@netapp.com, linux-nfs@vger.kernel.org
Subject: Re: [RFC PATCH] freezer: revert 27920651fe "PM / Freezer: Make fake_signal_wake_up() wake TASK_KILLABLE tasks too"
Date: Tue, 1 Nov 2011 20:39:23 +0100	[thread overview]
Message-ID: <20111101193923.GA9444@redhat.com> (raw)
In-Reply-To: <20111101182753.GW18855@google.com>

On 11/01, Tejun Heo wrote:
>
> Hello,
>
> On Tue, Nov 01, 2011 at 07:13:29PM +0100, Oleg Nesterov wrote:
> > On 11/01, Tejun Heo wrote:
> > >
> > > Yeah yeah, Trond already pointed it out.  I forgot about the
> > > sigpending special case in schedule(), which I think is rather odd,
> >
> > I disagree with "rather odd" ;)
> >
> > We have a lot of examples of
> >
> > 	current->state = TASK_INTERRUPTIBLE;
> > 	...
> > 	if (signal_pending())
> > 		break;
> > 	schedule();
> >
> > Without that special case in schedule() the code above becomes racy.
> > Just consider __wait_event_interruptible().
>
> But __wait_event_interruptible() does proper set-TASK_*, check
> sigpending and schedule() sequence.  As long as the waker performs
> seg-sigpending, wakeup sequence in the correct order, nothing is
> broken (as w/ any other wakeup conditions).  The special case deals
> with callers which don't check sigpending between set-TASK_* and
> schedule() and that's the part I think is a bit odd.

OK, agreed, __wait_event_interruptible() was a bad example.

Yes, this is only needed for the code which doesn't check
signal_pending() "properly", or doesn't check it at all before
schedule(). OK, say, wait_for_completion_interruptible().
Or schedule_timeout_interruptible().

I suspect we have a lot more examples. Historically linux allows to
set TASK_INTERRUPTIBLE and schedule() without any checks.

> Whether I feel
> odd or not is irrelevant tho - it's already there.

Yes, I don't think we can remove it.

> > > Any better ideas?
> >
> > Well. As a simple (probably temporary) fix, I'd suggest
> >
> > 	#define wait_event_freezekillable(wq, condition)
> > 	{
> > 		freezer_do_not_count();
> > 		__retval = wait_event_killable(condition);
> > 		freezer_count();
> > 		__retval;
> > 	}
> >
> > Do you think it can work?
>
> Yeah, probably.  I was hoping to remove count/do_not_count tho.

Or at least rename it ;)

> Hmmm... maybe we can just flip PF_NOFREEZE instead with a bit of
> modification, I think.

Perhaps.

Or we can add TASK_FREEZABLE (like TASK_WAKEKILL), iirc we already
discussed this some time ago. And probably it makes sense to add the
generic wait_event_state().

Oleg.


  reply	other threads:[~2011-11-01 19:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20111031221743.GA18855@google.com>
     [not found] ` <201111010024.16659.rjw@sisk.pl>
     [not found]   ` <20111031233059.GI18855@google.com>
     [not found]     ` <20111101005505.GO18855@google.com>
2011-11-01  8:13       ` [RFC PATCH] freezer: revert 27920651fe "PM / Freezer: Make fake_signal_wake_up() wake TASK_KILLABLE tasks too" Jeff Layton
2011-11-01 10:59         ` Jeff Layton
2011-11-01 16:30           ` Tejun Heo
2011-11-01 16:49             ` Trond Myklebust
2011-11-01 16:55               ` Tejun Heo
2011-11-01 17:59             ` Oleg Nesterov
2011-11-01 18:06               ` Tejun Heo
2011-11-01 18:13                 ` Oleg Nesterov
2011-11-01 18:27                   ` Tejun Heo
2011-11-01 19:39                     ` Oleg Nesterov [this message]
2011-11-01 19:46                       ` Oleg Nesterov
2011-11-01 21:57                         ` Tejun Heo
2011-11-02 11:42                           ` Jeff Layton
2011-11-02 15:13                             ` Oleg Nesterov
2011-11-02 16:23                           ` Oleg Nesterov
2011-11-02 23:11                             ` Rafael J. Wysocki
2011-11-03 11:15                               ` Jeff Layton
2011-11-03 15:10                               ` Oleg Nesterov
2011-11-02 17:53                           ` [PATCH] wait_event_freezekillable: use freezer_do_not_count/freezer_count Oleg Nesterov
2011-11-03 10:42                             ` Jeff Layton
2011-11-03 14:13                               ` Tejun Heo
2011-11-03 15:27                                 ` Jeff Layton
2011-11-03 15:30                                   ` Tejun Heo
2011-11-01 18:26                 ` [RFC PATCH] freezer: revert 27920651fe "PM / Freezer: Make fake_signal_wake_up() wake TASK_KILLABLE tasks too" Jeff Layton

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=20111101193923.GA9444@redhat.com \
    --to=oleg@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=rjw@sisk.pl \
    --cc=sfrench@samba.org \
    --cc=tj@kernel.org \
    --cc=trond.myklebust@netapp.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 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).