From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: matthltc@us.ibm.com, rjw@sisk.pl, paul@paulmenage.org,
containers@lists.linux-foundation.org,
linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] freezer: kill unused set_freezable_with_signal()
Date: Tue, 6 Sep 2011 17:18:36 +0200 [thread overview]
Message-ID: <20110906151836.GA15568@redhat.com> (raw)
In-Reply-To: <20110906032846.GA18425@mtj.dyndns.org>
Hi,
On 09/06, Tejun Heo wrote:
>
> Hello,
>
> On Mon, Sep 05, 2011 at 06:20:12PM +0200, Oleg Nesterov wrote:
> > Perhaps it is correct... Just I do not understand what it should do.
> > I thought it is "wait_for_event && do_not_block_freezer". And at first
> > glance the code looks as if it tries to do this. Say, in the "likely"
> > case we restart wait_event_interruptible() after refrigerator().
> >
> > But this looks racy. Suppose that freezing() is already false when
> > try_to_freeze() or __refrigerator() is called. Say, cgroup_freezer does
> > freeze_task() + __thaw_task(). Why it returns -ERESTARTSYS in this case?
>
> It may return -ERESTARTSYS when not strictly necessary but given that
> it's supposed to trigger restart anyway I don't think it's actually
> broken (it doesn't break the contract of the wait).
OK, but still this doesn't look right.
> Another thing to
> note is that kthread freezing via cgroup is almost fundamentally
> broken.
OK, let it be freeze_processes()+thaw_tasks(). Of course this is mostly
theoretical.
> > And if it can be used by the userspace thread, then we should probably
> > do recalc_sigpending() somewhere, otherwise wait_event_freezable() will
> > always return -ERESTARTSYS after __refrigerator().
>
> Thankfully, currently, all the few users are kthreads. I don't think
> it makes sense for userland tasks at all.
Yes, agreed. In this case I think it should be
#define wait_event_freezable(wq, condition) \
({ \
int __retval; \
for (;;) { \
__retval = wait_event_interruptible(wq, \
(condition) || freezing(current)); \
if (__retval || (condition)) \
break; \
try_to_freeze(); \
} \
__retval; \
})
__retval/ERESTARTSYS is only needed for kthreads which play with allow_signal(),
probably nobody should do this.
Oleg.
next prev parent reply other threads:[~2011-09-06 15:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 18:27 [PATCHSET pm-freezer] freezer: fixes & simplifications Tejun Heo
2011-09-02 18:27 ` [PATCH 1/6] cgroup_freezer: fix freezer->state setting bug in freezer_change_state() Tejun Heo
2011-09-04 18:02 ` Oleg Nesterov
2011-09-04 18:11 ` Tejun Heo
2011-09-04 18:20 ` Oleg Nesterov
2011-09-02 18:27 ` [PATCH 2/6] freezer: set PF_NOFREEZE on a dying task right before TASK_DEAD " Tejun Heo
2011-09-02 18:27 ` [PATCH 3/6] freezer: restructure __refrigerator() Tejun Heo
2011-09-02 18:27 ` [PATCH 4/6] freezer: use lock_task_sighand() in fake_signal_wake_up() Tejun Heo
2011-09-02 18:27 ` [PATCH 5/6] freezer: remove unused @sig_only from freeze_task() Tejun Heo
2011-09-02 18:27 ` [PATCH 6/6] freezer: kill unused set_freezable_with_signal() Tejun Heo
2011-09-04 18:46 ` Oleg Nesterov
2011-09-05 2:33 ` Tejun Heo
2011-09-05 2:35 ` Tejun Heo
2011-09-05 16:21 ` Oleg Nesterov
2011-09-05 16:20 ` Oleg Nesterov
2011-09-06 3:28 ` Tejun Heo
2011-09-06 15:18 ` Oleg Nesterov [this message]
2011-09-06 15:25 ` Oleg Nesterov
2011-09-06 15:53 ` Tejun Heo
2011-09-07 18:21 ` [PATCH 0/1] freezer: fix wait_event_freezable/__thaw_task races Oleg Nesterov
2011-09-07 18:22 ` [PATCH 1/1] " Oleg Nesterov
2011-09-08 1:05 ` Tejun Heo
2011-09-08 17:59 ` Oleg Nesterov
2011-09-11 1:54 ` Tejun Heo
2011-09-11 18:29 ` Oleg Nesterov
2011-09-11 18:41 ` Oleg Nesterov
2011-09-08 18:01 ` [PATCH 6/6] freezer: kill unused set_freezable_with_signal() Matt Helsley
2011-09-11 1:37 ` Tejun Heo
2011-09-04 18:48 ` [PATCHSET pm-freezer] freezer: fixes & simplifications Oleg Nesterov
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=20110906151836.GA15568@redhat.com \
--to=oleg@redhat.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=matthltc@us.ibm.com \
--cc=paul@paulmenage.org \
--cc=rjw@sisk.pl \
--cc=tj@kernel.org \
/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).