linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Steve French <sfrench@samba.org>,
	linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
	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 09:30:59 -0700	[thread overview]
Message-ID: <20111101163059.GR18855@google.com> (raw)
In-Reply-To: <20111101065958.50addab5@tlielax.poochiereds.net>

Hello, Jeff.

On Tue, Nov 01, 2011 at 06:59:58AM -0400, Jeff Layton wrote:
> > I suppose we could look at going back to the world of complicated
> > signal handling and TASK_INTERRUPTIBLE, but that's not a trivial change
> > either. The TASK_WAKE_FREEZABLE flag you mention might make more sense
> > than doing that.

I see.

> Also, since task state and signal handling clearly isn't my forte...can
> you clarify what the main difference is in using a TASK_KILLABLE sleep
> vs. TASK_INTERRUPTIBLE with all signals but SIGKILL blocked?
>
> I know that the process state would end up different (S vs. D state).
> Is there anything else we'd need to be concerned with if we converted
> all these call sites to use such a scheme in lieu of a new
> TASK_WAKE_FREEZABLE flag or similar?

Manipulating sigmask would work in most cases but there are corner
cases (e.g. debug signals will force the mask off) and diddling with
sigmask in kernel generally isn't a good idea.

If TASK_KILLABLE is only used for killable && freezable, that probably
would be the cleanest solution but given the name and the fact that
people are in general much more aware of SIGKILL's then freezer, I
think adding such assumption is likely to cause very subtle bugs.  For
example, mem_cgroup_handle_oom() seems to assume that if it's waken
from TASK_KILLABLE either the condition it was waiting for is true or
it is dying.

If there are only a handful sites which need this type of behavior,
wouldn't something like the following work?

#define wait_event_freezekillable(wq, condition)			\
do {									\
	DEFINE_WAIT(__wait);						\
	for (;;) {							\
		prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE);	\
		if (condition || fatal_signal_pending(current))		\
			break;						\
		schedule();						\
		try_to_freeze();					\
	}								\
	finish_wait(&wq, &__wait);					\
} while (0)

Thanks.

-- 
tejun

  reply	other threads:[~2011-11-01 16:31 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 [this message]
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
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=20111101163059.GR18855@google.com \
    --to=tj@kernel.org \
    --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=oleg@redhat.com \
    --cc=rjw@sisk.pl \
    --cc=sfrench@samba.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).