From: Pavel Machek <pavel@suse.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: pm list <linux-pm@lists.linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, Len Brown <lenb@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Matt Helsley <matthltc@us.ibm.com>,
Cedric Le Goater <clg@fr.ibm.com>,
Paul Menage <menage@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [RFC][PATCH 1/2] Freezer: Introduce PF_FREEZER_NOSIG
Date: Wed, 7 May 2008 11:36:21 +0200 [thread overview]
Message-ID: <20080507093621.GF13858@elf.ucw.cz> (raw)
In-Reply-To: <200805070005.20403.rjw@sisk.pl>
Hi!
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> The freezer currently attempts to distinguish kernel threads from
> user space tasks by checking if their mm pointer is unset and it
> does not send fake signals to kernel threads. However, there are
> kernel threads, mostly related to networking, that behave like
> user space tasks and may want to be sent a fake signal to be frozen.
>
> Introduce the new process flag PF_FREEZER_NOSIG that will be set
> by default for all kernel threads and make the freezer only send
> fake signals to the tasks having PF_FREEZER_NOSIG unset. Provide
> the set_freezable_with_signal() function to be called by the kernel
> threads that want to be sent a fake signal for freezing.
>
> This patch should not change the freezer's observable behavior.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
ACK.
> -static int has_mm(struct task_struct *p)
> +static inline bool should_send_signal(struct task_struct *p)
> {
> - return (p->mm && !(p->flags & PF_BORROWED_MM));
> + return !(current->flags & PF_FREEZER_NOSIG);
> }
>
Note that we used to tell kernel threads by ->mm, and now you assume
that anything created by ktrheadd is kernel thread, ->mm or not.
I'm not sure if those can differ (->mm = NULL somewhere? Or ->mm =
something somewhere else?). I guess this should go to -mm for a long
test...
> @@ -234,7 +234,7 @@ int kthreadd(void *unused)
> set_user_nice(tsk, KTHREAD_NICE_LEVEL);
> set_cpus_allowed(tsk, CPU_MASK_ALL);
>
> - current->flags |= PF_NOFREEZE;
> + current->flags |= PF_NOFREEZE | PF_FREEZER_NOSIG;
>
> for (;;) {
> set_current_state(TASK_INTERRUPTIBLE);
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2008-05-07 9:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 22:03 [RFC][PATCH 0/2] Freezer face lifting Rafael J. Wysocki
2008-05-06 22:05 ` [RFC][PATCH 1/2] Freezer: Introduce PF_FREEZER_NOSIG Rafael J. Wysocki
2008-05-07 0:38 ` [linux-pm] " Gautham R Shenoy
2008-05-07 12:11 ` Rafael J. Wysocki
2008-05-07 9:36 ` Pavel Machek [this message]
2008-05-07 12:16 ` Rafael J. Wysocki
2008-05-06 22:07 ` [RFC][PATCH 2/2] Freezer: Try to handle killable tasks Rafael J. Wysocki
2008-05-07 9:41 ` Pavel Machek
2008-05-07 13:57 ` Matthew Wilcox
2008-05-07 18:35 ` Rafael J. Wysocki
2008-05-07 13:53 ` Matthew Wilcox
2008-05-07 18:41 ` Rafael J. Wysocki
2008-05-19 22:59 ` Pavel Machek
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=20080507093621.GF13858@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=clg@fr.ibm.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
--cc=mingo@elte.hu \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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