From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mandeep Singh Baines <msb@chromium.org>,
Neil Horman <nhorman@redhat.com>, Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] freezer: do not send a fake signal to a PF_DUMPCORE thread
Date: Mon, 25 Feb 2013 00:39:03 +0100 [thread overview]
Message-ID: <45402727.PXDVBuj6zy@vostro.rjw.lan> (raw)
In-Reply-To: <20130224183656.GA8903@redhat.com>
On Sunday, February 24, 2013 07:36:56 PM Oleg Nesterov wrote:
> A coredumping thread can't be frozen anyway but the fake signal sent
> by freeze_task() can confuse dump_write/wait_for_dump_helpers/etc
> and interrupt the coredump.
>
> We are going to make the do_coredump() paths freezable but the fake
> TIF_SIGPENDING doesn't help, it only makes sense when we assume that
> the target can return to user-mode and call get_signal_to_deliver().
>
> Change freeze_task() to check PF_DUMPCORE along with PF_KTHREAD. We
> need to recheck PF_DUMPCORE under ->siglock to avoid the race with
> zap_threads() which can set this flag right before we take the lock.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> kernel/freezer.c | 19 ++++++++++++-------
> 1 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/freezer.c b/kernel/freezer.c
> index c38893b..595afab 100644
> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -85,14 +85,21 @@ bool __refrigerator(bool check_kthr_stop)
> }
> EXPORT_SYMBOL(__refrigerator);
>
> -static void fake_signal_wake_up(struct task_struct *p)
> +static bool fake_signal_wake_up(struct task_struct *p)
> {
> unsigned long flags;
> + bool ret = false;
> +
> + if (p->flags & (PF_KTHREAD | PF_DUMPCORE))
> + return ret;
>
> if (lock_task_sighand(p, &flags)) {
> - signal_wake_up(p, 0);
> + ret = !(p->flags & PF_DUMPCORE);
> + if (ret)
> + signal_wake_up(p, 0);
> unlock_task_sighand(p, &flags);
> }
> + return ret;
> }
>
> /**
> @@ -100,8 +107,8 @@ static void fake_signal_wake_up(struct task_struct *p)
> * @p: task to send the request to
> *
> * If @p is freezing, the freeze request is sent either by sending a fake
> - * signal (if it's not a kernel thread) or waking it up (if it's a kernel
> - * thread).
> + * signal (if it's not a kernel thread or a coredumping thread) or waking
> + * it up otherwise.
> *
> * RETURNS:
> * %false, if @p is not freezing or already frozen; %true, otherwise
> @@ -116,9 +123,7 @@ bool freeze_task(struct task_struct *p)
> return false;
> }
>
> - if (!(p->flags & PF_KTHREAD))
> - fake_signal_wake_up(p);
> - else
> + if (!fake_signal_wake_up(p))
> wake_up_state(p, TASK_INTERRUPTIBLE);
>
> spin_unlock_irqrestore(&freezer_lock, flags);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-02-24 23:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-24 17:31 [PATCH -mm 0/3] coredump: make it freezable (almost) Oleg Nesterov
2013-02-24 17:32 ` [PATCH 1/3] coredump: factor out the setting of PF_DUMPCORE Oleg Nesterov
2013-02-24 17:32 ` [PATCH 2/3] freezer: do not send a fake signal to a PF_DUMPCORE thread Oleg Nesterov
2013-02-24 18:36 ` [PATCH v2 " Oleg Nesterov
2013-02-24 23:39 ` Rafael J. Wysocki [this message]
2013-02-26 16:37 ` Mandeep Singh Baines
2013-02-26 19:43 ` Mandeep Singh Baines
2013-02-27 18:08 ` Oleg Nesterov
2013-02-27 18:55 ` Oleg Nesterov
2013-02-28 15:39 ` Mandeep Singh Baines
2013-02-24 17:32 ` [PATCH 3/3] coredump: make wait_for_dump_helpers() freezable Oleg Nesterov
2013-02-28 20:19 ` Mandeep Singh Baines
2013-02-24 18:09 ` [PATCH -mm 0/3] coredump: make it freezable (almost) Oleg Nesterov
2013-02-25 23:05 ` Andrew Morton
2013-02-28 18:46 ` 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=45402727.PXDVBuj6zy@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msb@chromium.org \
--cc=nhorman@redhat.com \
--cc=oleg@redhat.com \
--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
Powered by JetHome