summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-10-29 23:23:44 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-10-29 23:23:44 -0800
commit22331dad4687ac6f91428884e2b9a02cb4d8a6df (patch)
tree4d3daf142b1414c8946e18ec498f84b234255a6a /kernel
parent706489d8a6f1187875ebdb86a751b6d77d1911e4 (diff)
[PATCH] slab: add_timer_on: add a timer on a particular CPU
add_timer_on is like add_timer, except it takes a target CPU on which to add the timer. The slab code needs per-cpu timers for shrinking the per-cpu caches.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 2d30f7fd0ecb..58c80293060b 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -135,6 +135,26 @@ void add_timer(timer_t *timer)
}
/***
+ * add_timer_on - start a timer on a particular CPU
+ * @timer: the timer to be added
+ * @cpu: the CPU to start it on
+ *
+ * This is not very scalable on SMP.
+ */
+void add_timer_on(struct timer_list *timer, int cpu)
+{
+ tvec_base_t *base = tvec_bases+ cpu;
+ unsigned long flags;
+
+ BUG_ON(timer_pending(timer) || !timer->function);
+
+ spin_lock_irqsave(&base->lock, flags);
+ internal_add_timer(base, timer);
+ timer->base = base;
+ spin_unlock_irqrestore(&base->lock, flags);
+}
+
+/***
* mod_timer - modify a timer's timeout
* @timer: the timer to be modified
*