Commit 6f9199b5 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Per-cpu variable in mm/slab.c

Rather trivial conversion.  Tested on SMP.
parent 26e48e57
...@@ -475,7 +475,7 @@ enum { ...@@ -475,7 +475,7 @@ enum {
FULL FULL
} g_cpucache_up; } 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); static void reap_timer_fnc(unsigned long data);
...@@ -525,7 +525,7 @@ static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg) ...@@ -525,7 +525,7 @@ static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg)
*/ */
static void start_cpu_timer(int cpu) 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) { if (rt->function == NULL) {
init_timer(rt); init_timer(rt);
...@@ -2457,7 +2457,7 @@ static inline void cache_reap (void) ...@@ -2457,7 +2457,7 @@ static inline void cache_reap (void)
static void reap_timer_fnc(unsigned long data) static void reap_timer_fnc(unsigned long data)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct timer_list *rt = &reap_timers[cpu]; struct timer_list *rt = &__get_cpu_var(reap_timers);
cache_reap(); cache_reap();
mod_timer(rt, jiffies + REAPTIMEOUT_CPUC + cpu); mod_timer(rt, jiffies + REAPTIMEOUT_CPUC + cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment