Commit 2c6e92ad authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Tasklet cleanup

This makes tasklet_vec and tasklet_hi_vec static inside softirq.c, and
makes them __per_cpu_data.
parent facdecfa
...@@ -124,14 +124,6 @@ enum ...@@ -124,14 +124,6 @@ enum
TASKLET_STATE_RUN /* Tasklet is running (SMP only) */ TASKLET_STATE_RUN /* Tasklet is running (SMP only) */
}; };
struct tasklet_head
{
struct tasklet_struct *list;
} __attribute__ ((__aligned__(SMP_CACHE_BYTES)));
extern struct tasklet_head tasklet_vec[NR_CPUS];
extern struct tasklet_head tasklet_hi_vec[NR_CPUS];
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static inline int tasklet_trylock(struct tasklet_struct *t) static inline int tasklet_trylock(struct tasklet_struct *t)
{ {
......
...@@ -568,8 +568,6 @@ EXPORT_SYMBOL(strspn); ...@@ -568,8 +568,6 @@ EXPORT_SYMBOL(strspn);
EXPORT_SYMBOL(strsep); EXPORT_SYMBOL(strsep);
/* software interrupts */ /* software interrupts */
EXPORT_SYMBOL(tasklet_hi_vec);
EXPORT_SYMBOL(tasklet_vec);
EXPORT_SYMBOL(bh_task_vec); EXPORT_SYMBOL(bh_task_vec);
EXPORT_SYMBOL(init_bh); EXPORT_SYMBOL(init_bh);
EXPORT_SYMBOL(remove_bh); EXPORT_SYMBOL(remove_bh);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/tqueue.h> #include <linux/tqueue.h>
#include <linux/percpu.h>
/* /*
- No shared variables, all the data are CPU local. - No shared variables, all the data are CPU local.
...@@ -145,42 +146,43 @@ void open_softirq(int nr, void (*action)(struct softirq_action*), void *data) ...@@ -145,42 +146,43 @@ void open_softirq(int nr, void (*action)(struct softirq_action*), void *data)
/* Tasklets */ /* Tasklets */
struct tasklet_head
{
struct tasklet_struct *list;
};
struct tasklet_head tasklet_vec[NR_CPUS] __cacheline_aligned_in_smp; static struct tasklet_head tasklet_vec __per_cpu_data;
struct tasklet_head tasklet_hi_vec[NR_CPUS] __cacheline_aligned_in_smp; static struct tasklet_head tasklet_hi_vec __per_cpu_data;
void __tasklet_schedule(struct tasklet_struct *t) void __tasklet_schedule(struct tasklet_struct *t)
{ {
int cpu = smp_processor_id();
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
t->next = tasklet_vec[cpu].list; t->next = this_cpu(tasklet_vec).list;
tasklet_vec[cpu].list = t; this_cpu(tasklet_vec).list = t;
cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); cpu_raise_softirq(smp_processor_id(), TASKLET_SOFTIRQ);
local_irq_restore(flags); local_irq_restore(flags);
} }
void __tasklet_hi_schedule(struct tasklet_struct *t) void __tasklet_hi_schedule(struct tasklet_struct *t)
{ {
int cpu = smp_processor_id();
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
t->next = tasklet_hi_vec[cpu].list; t->next = this_cpu(tasklet_hi_vec).list;
tasklet_hi_vec[cpu].list = t; this_cpu(tasklet_hi_vec).list = t;
cpu_raise_softirq(cpu, HI_SOFTIRQ); cpu_raise_softirq(smp_processor_id(), HI_SOFTIRQ);
local_irq_restore(flags); local_irq_restore(flags);
} }
static void tasklet_action(struct softirq_action *a) static void tasklet_action(struct softirq_action *a)
{ {
int cpu = smp_processor_id();
struct tasklet_struct *list; struct tasklet_struct *list;
local_irq_disable(); local_irq_disable();
list = tasklet_vec[cpu].list; list = this_cpu(tasklet_vec).list;
tasklet_vec[cpu].list = NULL; this_cpu(tasklet_vec).list = NULL;
local_irq_enable(); local_irq_enable();
while (list) { while (list) {
...@@ -200,21 +202,20 @@ static void tasklet_action(struct softirq_action *a) ...@@ -200,21 +202,20 @@ static void tasklet_action(struct softirq_action *a)
} }
local_irq_disable(); local_irq_disable();
t->next = tasklet_vec[cpu].list; t->next = this_cpu(tasklet_vec).list;
tasklet_vec[cpu].list = t; this_cpu(tasklet_vec).list = t;
__cpu_raise_softirq(cpu, TASKLET_SOFTIRQ); __cpu_raise_softirq(smp_processor_id(), TASKLET_SOFTIRQ);
local_irq_enable(); local_irq_enable();
} }
} }
static void tasklet_hi_action(struct softirq_action *a) static void tasklet_hi_action(struct softirq_action *a)
{ {
int cpu = smp_processor_id();
struct tasklet_struct *list; struct tasklet_struct *list;
local_irq_disable(); local_irq_disable();
list = tasklet_hi_vec[cpu].list; list = this_cpu(tasklet_hi_vec).list;
tasklet_hi_vec[cpu].list = NULL; this_cpu(tasklet_hi_vec).list = NULL;
local_irq_enable(); local_irq_enable();
while (list) { while (list) {
...@@ -234,9 +235,9 @@ static void tasklet_hi_action(struct softirq_action *a) ...@@ -234,9 +235,9 @@ static void tasklet_hi_action(struct softirq_action *a)
} }
local_irq_disable(); local_irq_disable();
t->next = tasklet_hi_vec[cpu].list; t->next = this_cpu(tasklet_hi_vec).list;
tasklet_hi_vec[cpu].list = t; this_cpu(tasklet_hi_vec).list = t;
__cpu_raise_softirq(cpu, HI_SOFTIRQ); __cpu_raise_softirq(smp_processor_id(), HI_SOFTIRQ);
local_irq_enable(); local_irq_enable();
} }
} }
......
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