Per-cpu variable in mm/slab.c

Per-cpu variable in mm/slab.c

Post by Rusty Russel » Fri, 04 Jul 2003 08:50:07



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

        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);

  */
 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) {

 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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. Make runqueues a per-cpu variable

Linus, please apply.

Makes scheduler use per-cpu variables for the runqueues.

Name: Make Scheduler Use per-cpu
Author: Rusty Russell
Status: Tested on 2.5.73-bk8

D: Makes scheduler use per-cpu variables for the runqueues.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .27023-linux-2.5.73-bk4/kernel/sched.c .27023-linux-2.5.73-bk4.updated/kernel/sched.c
--- .27023-linux-2.5.73-bk4/kernel/sched.c      2003-06-27 12:48:17.000000000 +1000

 #include <linux/timer.h>
 #include <linux/rcupdate.h>
 #include <linux/cpu.h>
+#include <linux/percpu.h>

 #ifdef CONFIG_NUMA

        struct list_head migration_queue;

        atomic_t nr_iowait;
-} ____cacheline_aligned;
+};

-static struct runqueue runqueues[NR_CPUS] __cacheline_aligned;
+static DEFINE_PER_CPU(struct runqueue, runqueues);

-#define cpu_rq(cpu)            (runqueues + (cpu))
-#define this_rq()              cpu_rq(smp_processor_id())
+#define cpu_rq(cpu)            (&per_cpu(runqueues, (cpu)))
+#define this_rq()              (&__get_cpu_var(runqueues))
 #define task_rq(p)             cpu_rq(task_cpu(p))
 #define cpu_curr(cpu)          (cpu_rq(cpu)->curr)
 #define rt_task(p)             ((p)->prio < MAX_RT_PRIO)

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. > 64MB memory and hanging

3. On Local Per-Cpu Variables

4. AIX on a G3?

5. Make ksoftirqd a normal per-cpu variable

6. Compaq Contura Aero and PLIP

7. Make ksoftirqd a per-cpu variable

8. Print Quality Selection

9. PATCH mm/slab.c against 2.5.15 (was: slab cache broken on sparc64 )

10. Make ksoftirqd a normal per-cpu variable.

11. How to initialize complex per-cpu variables?

12. PATCH mm/slab.c against 2.5.15 (was: slab cache broken on spa rc64)

13. [RFC] per cpu slab fix to reduce freemiss