From: Linus Torvalds <torvalds@linux-foundation.org>
To: Gautham R Shenoy <ego@in.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>, Pavel Machek <pavel@ucw.cz>,
Oleg Nesterov <oleg@tv-sign.ru>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Dipankar Sarma <dipankar@in.ibm.com>, Ingo Molnar <mingo@elte.hu>,
Srivatsa Vaddagiri <vatsa@in.ibm.com>,
Paul E McKenney <paulmck@us.ibm.com>
Subject: Re: [RFD] Freezing of kernel threads
Date: Sun, 13 May 2007 09:33:41 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.98.0705130925290.6739@woody.linux-foundation.org> (raw)
In-Reply-To: <20070513083357.GA12985@in.ibm.com>
On Sun, 13 May 2007, Gautham R Shenoy wrote:
>
> RFC #1: Use get_hot_cpus()- put_hot_cpus() , which follow the
> well known refcounting model.
Yes. And usign the "preempt count" as a refcount is fairly natural, no?
We do already depend on that in many code-paths.
It also has the advantage since it's not a *blocking* lock, it's fairly
easy to code around (ie since it nests, it avoids the kinds of nasty
deadlocks we had with cpufreq that had totally insane calling semantics
and different people all wanted the lock).
Of course, a real nesting lock could be used to the same effect.
> RFC #1 and #2 DO work. But, the discussions in the thread
> http://lkml.org/lkml/2007/1/26/282 gave me the impression
> that we would be better off without any code audits to
> make the code paths cpu-hotplug safe. I would leave it for others
> to shed more light here.
Well, I hope that _this_ discussion about the freezer has convinced you
that there are no more fundamntal problems with #1/#2 than with using the
freezer.
The freezer really needs even *more* code auditing, since it's almost
impossible to see which thread depends on some other thread. There's a
real reason why most kernel threads disable freezing.
At least with locking, the code-paths you require to audit are all
actually relevant to cpu hotplug, and you can easily add dynamic
_automated_ tests like "if you use online_cpu_map, you'd better hold the
preempt lock".
For example, since all users of cpu_online_map should be pure *readers*
(apart from a couple of cases that actually bring up a CPU), you can do
things like
#define cpu_online_map check_cpu_online_map()
static inline cpumask_t check_cpu_online_map(void)
{
WARN_ON(!preempt_safe()); /* or whatever lock we decide on */
return __real_cpu_online_map;
}
and it will nicely catch things like that.
Linus
next prev parent reply other threads:[~2007-05-13 16:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-12 18:17 Rafael J. Wysocki
2007-05-12 18:25 ` Linus Torvalds
2007-05-12 21:14 ` Rafael J. Wysocki
2007-05-12 19:17 ` Pavel Machek
2007-05-12 19:40 ` Linus Torvalds
2007-05-12 22:14 ` Pavel Machek
2007-05-12 22:08 ` Rafael J. Wysocki
2007-05-12 19:36 ` Gautham R Shenoy
2007-05-12 19:57 ` Linus Torvalds
2007-05-12 20:11 ` Linus Torvalds
2007-05-13 8:33 ` Gautham R Shenoy
2007-05-13 16:33 ` Linus Torvalds [this message]
2007-05-13 20:08 ` Rafael J. Wysocki
2007-05-13 20:49 ` Linus Torvalds
2007-05-13 21:14 ` Rafael J. Wysocki
2007-05-14 6:18 ` Srivatsa Vaddagiri
2007-05-14 7:26 ` Gautham R Shenoy
2007-05-14 10:07 ` Rafael J. Wysocki
2007-05-14 7:41 ` Dipankar Sarma
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=alpine.LFD.0.98.0705130925290.6739@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=dipankar@in.ibm.com \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--cc=paulmck@us.ibm.com \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=vatsa@in.ibm.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
all inboxes | Powered by JetHome®