From: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Paul Menage <paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org>
Subject: Re: [PATCH pm-freezer 1/4] cgroup_freezer: fix freezer->state setting bug in freezer_change_state()
Date: Fri, 2 Sep 2011 19:30:39 +0200 [thread overview]
Message-ID: <20110902173039.GA9039@redhat.com> (raw)
In-Reply-To: <20110902170844.GJ2752-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
On 09/03, Tejun Heo wrote:
>
> Can you please wait a bit?
Sure. But just in case, I mean the simple patch below.
Feel free to incorporate into 4/4, or I can resend it later.
Oleg.
------------------------------------------------------------------------------
[PATCH] freezer: remove the pointless/unsafe __thaw_task()->recalc_sigpending_and_wake()
Remove __thaw_task()->recalc_sigpending_and_wake(). It was copied from
cancel_freezing() recently, but it was always wrong.
It is pointless, contary to the comment it can't clear TIF_SIGPENDING.
Not to mention, we must never do this with !current task, this is wrong.
The usage of ->sighand is not safe if the caller is cgroup_freezer, we
can racw with exit.
Signed-off-by: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
kernel/freezer.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
--- 3.1/kernel/freezer.c~kill_rspaw 2011-09-02 18:52:46.000000000 +0200
+++ 3.1/kernel/freezer.c 2011-09-02 19:03:30.000000000 +0200
@@ -150,18 +150,10 @@ void __thaw_task(struct task_struct *p)
* be visible to @p as waking up implies wmb. Waking up inside
* freezer_lock also prevents wakeups from leaking outside
* refrigerator.
- *
- * If !FROZEN, @p hasn't reached refrigerator, recalc sigpending to
- * avoid leaving dangling TIF_SIGPENDING behind.
*/
spin_lock_irqsave(&freezer_lock, flags);
- if (frozen(p)) {
+ if (frozen(p))
wake_up_process(p);
- } else {
- spin_lock(&p->sighand->siglock);
- recalc_sigpending_and_wake(p);
- spin_unlock(&p->sighand->siglock);
- }
spin_unlock_irqrestore(&freezer_lock, flags);
}
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Matt Helsley <matthltc@us.ibm.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Paul Menage <paul@paulmenage.org>,
containers@lists.linux-foundation.org,
linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH pm-freezer 1/4] cgroup_freezer: fix freezer->state setting bug in freezer_change_state()
Date: Fri, 2 Sep 2011 19:30:39 +0200 [thread overview]
Message-ID: <20110902173039.GA9039@redhat.com> (raw)
In-Reply-To: <20110902170844.GJ2752@htj.dyndns.org>
On 09/03, Tejun Heo wrote:
>
> Can you please wait a bit?
Sure. But just in case, I mean the simple patch below.
Feel free to incorporate into 4/4, or I can resend it later.
Oleg.
------------------------------------------------------------------------------
[PATCH] freezer: remove the pointless/unsafe __thaw_task()->recalc_sigpending_and_wake()
Remove __thaw_task()->recalc_sigpending_and_wake(). It was copied from
cancel_freezing() recently, but it was always wrong.
It is pointless, contary to the comment it can't clear TIF_SIGPENDING.
Not to mention, we must never do this with !current task, this is wrong.
The usage of ->sighand is not safe if the caller is cgroup_freezer, we
can racw with exit.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/freezer.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
--- 3.1/kernel/freezer.c~kill_rspaw 2011-09-02 18:52:46.000000000 +0200
+++ 3.1/kernel/freezer.c 2011-09-02 19:03:30.000000000 +0200
@@ -150,18 +150,10 @@ void __thaw_task(struct task_struct *p)
* be visible to @p as waking up implies wmb. Waking up inside
* freezer_lock also prevents wakeups from leaking outside
* refrigerator.
- *
- * If !FROZEN, @p hasn't reached refrigerator, recalc sigpending to
- * avoid leaving dangling TIF_SIGPENDING behind.
*/
spin_lock_irqsave(&freezer_lock, flags);
- if (frozen(p)) {
+ if (frozen(p))
wake_up_process(p);
- } else {
- spin_lock(&p->sighand->siglock);
- recalc_sigpending_and_wake(p);
- spin_unlock(&p->sighand->siglock);
- }
spin_unlock_irqrestore(&freezer_lock, flags);
}
next prev parent reply other threads:[~2011-09-02 17:30 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 10:21 [PATCH pm-freezer 1/4] cgroup_freezer: fix freezer->state setting bug in freezer_change_state() Tejun Heo
2011-08-31 10:21 ` [PATCH pm-freezer 2/4] freezer: set PF_NOFREEZE on a dying task right before TASK_DEAD " Tejun Heo
2011-08-31 10:21 ` Tejun Heo
2011-08-31 10:22 ` [PATCH pm-freezer 3/4] freezer: restructure __refrigerator() Tejun Heo
[not found] ` <20110831102143.GB2828-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2011-08-31 10:22 ` Tejun Heo
2011-08-31 10:22 ` Tejun Heo
2011-08-31 10:22 ` [PATCH pm-freezer 4/4] freezer: use lock_task_sighand() in fake_signal_wake_up() Tejun Heo
2011-08-31 10:22 ` Tejun Heo
[not found] ` <20110831102210.GC2828-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2011-08-31 10:22 ` Tejun Heo
2011-09-02 17:08 ` [PATCH pm-freezer 3/4] freezer: restructure __refrigerator() Oleg Nesterov
2011-09-02 17:08 ` Oleg Nesterov
2011-09-02 17:08 ` Oleg Nesterov
2011-08-31 18:08 ` [PATCH pm-freezer 1/4] cgroup_freezer: fix freezer->state setting bug in freezer_change_state() Oleg Nesterov
2011-08-31 18:08 ` Oleg Nesterov
[not found] ` <20110831102100.GA2828-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2011-08-31 10:21 ` [PATCH pm-freezer 2/4] freezer: set PF_NOFREEZE on a dying task right before TASK_DEAD " Tejun Heo
2011-08-31 18:08 ` [PATCH pm-freezer 1/4] cgroup_freezer: fix freezer->state " Oleg Nesterov
2011-09-02 0:42 ` Matt Helsley
2011-09-02 0:42 ` Matt Helsley
2011-09-02 2:50 ` Tejun Heo
2011-09-02 2:50 ` Tejun Heo
2011-09-02 16:58 ` Oleg Nesterov
[not found] ` <20110902004231.GF1919-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2011-09-02 2:50 ` Tejun Heo
2011-09-02 16:58 ` Oleg Nesterov
2011-09-02 16:58 ` Oleg Nesterov
[not found] ` <20110902165839.GA7478-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-02 17:08 ` Tejun Heo
2011-09-02 18:31 ` Matt Helsley
2011-09-02 17:08 ` Tejun Heo
2011-09-02 17:15 ` Oleg Nesterov
[not found] ` <20110902170844.GJ2752-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-09-02 17:15 ` Oleg Nesterov
2011-09-02 17:30 ` Oleg Nesterov [this message]
2011-09-02 17:30 ` Oleg Nesterov
2011-09-02 17:15 ` Oleg Nesterov
[not found] ` <20110902171517.GA8247-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-02 17:31 ` Tejun Heo
2011-09-02 17:31 ` Tejun Heo
2011-09-02 17:31 ` Tejun Heo
2011-09-02 17:30 ` Oleg Nesterov
2011-09-02 17:08 ` Tejun Heo
2011-09-02 18:31 ` Matt Helsley
2011-09-02 18:31 ` Matt Helsley
2011-09-02 0:42 ` Matt Helsley
-- strict thread matches above, loose matches on Subject: below --
2011-08-31 10:21 Tejun Heo
2011-08-31 10:21 Tejun Heo
2011-08-29 14:04 Tejun Heo
2011-08-29 14:04 Tejun Heo
2011-08-29 16:00 ` Oleg Nesterov
2011-08-29 16:00 ` Oleg Nesterov
[not found] ` <20110829140418.GB18871-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2011-08-29 16:00 ` Oleg Nesterov
2011-08-29 14:04 Tejun Heo
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=20110902173039.GA9039@redhat.com \
--to=oleg-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=paul-inf54ven1CmVyaH7bEyXVA@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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.