* [PATCH] Per-cpu variable in mm/slab.c
@ 2003-07-03 6:23 Rusty Russell
0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2003-07-03 6:23 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, Zwane Mwaikambo, trivial
Linus, please apply. From Zwane.
Name: Make slab.c reap_timers per-cpu
Author: Zwane Mwaikambo
Status: Tested on 2.5.73
D: Rather trivial conversion. Tested on SMP.
Index: linux-2.5/mm/slab.c
===================================================================
RCS file: /home/cvs/linux-2.5/mm/slab.c,v
retrieving revision 1.91
diff -u -p -B -r1.91 slab.c
--- linux-2.5/mm/slab.c 28 Jun 2003 21:10:44 -0000 1.91
+++ linux-2.5/mm/slab.c 3 Jul 2003 01:34:36 -0000
@@ -441,7 +441,7 @@ enum {
FULL
} g_cpucache_up;
-static struct timer_list reap_timers[NR_CPUS];
+static DEFINE_PER_CPU(struct timer_list, reap_timers);
static void reap_timer_fnc(unsigned long data);
@@ -491,7 +491,7 @@ static void __slab_error(const char *fun
*/
static void start_cpu_timer(int cpu)
{
- struct timer_list *rt = &reap_timers[cpu];
+ struct timer_list *rt = &per_cpu(reap_timers, cpu);
if (rt->function == NULL) {
init_timer(rt);
@@ -2382,7 +2382,7 @@ next:
static void reap_timer_fnc(unsigned long data)
{
int cpu = smp_processor_id();
- struct timer_list *rt = &reap_timers[cpu];
+ struct timer_list *rt = &__get_cpu_var(reap_timers);
cache_reap();
mod_timer(rt, jiffies + REAPTIMEOUT_CPUC + cpu);
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-03 6:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03 6:23 [PATCH] Per-cpu variable in mm/slab.c Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).