]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] percpu: convert softirqs
authorAndrew Morton <akpm@digeo.com>
Wed, 30 Oct 2002 07:31:47 +0000 (23:31 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 30 Oct 2002 07:31:47 +0000 (23:31 -0800)
Patch from Dipankar Sarma <dipankar@in.ibm.com>

This patch makes per_cpu tasklet vectors safe for cpu_possible
allocation by using CPU notifiers.

kernel/softirq.c

index 1c0f1c4e39e0e6c1f7757f5162a8ee44c51378f8..59fb7acb0ee18e723257ced1efe6a3e7e9056c67 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/percpu.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/notifier.h>
 
 /*
    - No shared variables, all the data are CPU local.
@@ -260,10 +261,39 @@ void tasklet_kill(struct tasklet_struct *t)
        clear_bit(TASKLET_STATE_SCHED, &t->state);
 }
 
+
+static void tasklet_init_cpu(int cpu)
+{
+       per_cpu(tasklet_vec, cpu).list = NULL;
+       per_cpu(tasklet_hi_vec, cpu).list = NULL;
+}
+       
+static int tasklet_cpu_notify(struct notifier_block *self, 
+                               unsigned long action, void *hcpu)
+{
+       long cpu = (long)hcpu;
+       switch(action) {
+       case CPU_UP_PREPARE:
+               tasklet_init_cpu(cpu);
+               break;
+       default:
+               break;
+       }
+       return 0;
+}
+
+static struct notifier_block tasklet_nb = {
+       .notifier_call  = tasklet_cpu_notify,
+       .next           = NULL,
+};
+
 void __init softirq_init()
 {
        open_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);
        open_softirq(HI_SOFTIRQ, tasklet_hi_action, NULL);
+       tasklet_cpu_notify(&tasklet_nb, (unsigned long)CPU_UP_PREPARE,
+                               (void *)(long)smp_processor_id());
+       register_cpu_notifier(&tasklet_nb);
 }
 
 static int ksoftirqd(void * __bind_cpu)
@@ -320,7 +350,9 @@ static int __devinit cpu_callback(struct notifier_block *nfb,
        return NOTIFY_OK;
 }
 
-static struct notifier_block cpu_nfb = { &cpu_callback, NULL, 0 };
+static struct notifier_block __devinitdata cpu_nfb = {
+       .notifier_call = cpu_callback
+};
 
 __init int spawn_ksoftirqd(void)
 {