From: Rusty Russell <rusty@rustcorp.com.au>
To: Christoph Hellwig <hch@infradead.org>
Cc: Anton Blanchard <anton@samba.org>, Andrew Morton <akpm@osdl.org>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpu hotplug fix
Date: Sat, 20 Mar 2004 21:59:12 +1100 [thread overview]
Message-ID: <1079780351.18972.48.camel@bach> (raw)
In-Reply-To: <20040320074033.A21586@infradead.org>
On Sat, 2004-03-20 at 18:40, Christoph Hellwig wrote:
> On Sat, Mar 20, 2004 at 05:36:42PM +1100, Anton Blanchard wrote:
> >
> > start_cpu_timer was changed to __init a few hours before the cpu hotplug
> > patches went in. With cpu hotplug it can be called at any time, so fix
> > this.
>
> So we're wasting memory due to the few machines supporting hot-plug cpus
> in slab now? What about adding __cpuinit ala __devinit instead?
Just use __devinit.
More importantly, Christoph, you're missing the forest through the
trees: what the hell is start_cpu_timer trying to do?
Name: Remove Strange start_cpu_timer Code
Status: Untested
Why is start_cpu_timer checking for fn being NULL? And why isn't
every CPU's reap_timer initialized in cpucache_init (which is an
__init function).
Clean up this mess by just starting the timer in start_cpu_timer.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .15051-linux-2.6.5-rc2/mm/slab.c .15051-linux-2.6.5-rc2.updated/mm/slab.c
--- .15051-linux-2.6.5-rc2/mm/slab.c 2004-03-20 21:21:33.000000000 +1100
+++ .15051-linux-2.6.5-rc2.updated/mm/slab.c 2004-03-20 21:45:06.000000000 +1100
@@ -576,17 +576,12 @@ static void __slab_error(const char *fun
* Add the CPU number into the expiry time to minimize the possibility of the
* CPUs getting into lockstep and contending for the global cache chain lock.
*/
-static void __init start_cpu_timer(int cpu)
+static inline void start_cpu_timer(int cpu)
{
struct timer_list *rt = &per_cpu(reap_timers, cpu);
- if (rt->function == NULL) {
- init_timer(rt);
- rt->expires = jiffies + HZ + 3*cpu;
- rt->data = cpu;
- rt->function = reap_timer_fnc;
- add_timer_on(rt, cpu);
- }
+ rt->expires = jiffies + HZ + 3*cpu;
+ add_timer_on(rt, cpu);
}
#ifdef CONFIG_HOTPLUG_CPU
@@ -798,7 +793,13 @@ int __init cpucache_init(void)
* Register the timers that return unneeded
* pages to gfp.
*/
- for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ for_each_cpu(cpu) {
+ struct timer_list *rt = &per_cpu(reap_timers, cpu);
+
+ init_timer(rt);
+ rt->data = cpu;
+ rt->function = reap_timer_fnc;
+
if (cpu_online(cpu))
start_cpu_timer(cpu);
}
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
next prev parent reply other threads:[~2004-03-20 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-20 6:36 [PATCH] cpu hotplug fix Anton Blanchard
2004-03-20 7:40 ` Christoph Hellwig
2004-03-20 10:59 ` Rusty Russell [this message]
2004-03-20 23:12 ` Andrew Morton
2004-03-22 6:36 ` Rusty Russell
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=1079780351.18972.48.camel@bach \
--to=rusty@rustcorp.com.au \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.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