diff options
author | Dimitri Sivanich <sivanich@sgi.com> | 2004-08-22 22:47:04 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 22:47:04 -0700 |
commit | 346ed9c13aab9be890a8bd52d06fd6761876bb85 (patch) | |
tree | 1dfd7e51f807757ba615601273dc60ddebfe11e2 /kernel | |
parent | 6cfa4c9fd86139036d1b03578235c607a1b94d0a (diff) | |
download | history-346ed9c13aab9be890a8bd52d06fd6761876bb85.tar.gz |
[PATCH] Move cache_reap out of timer context
I'm submitting two patches associated with moving cache_reap functionality
out of timer context. Note that these patches do not make any further
optimizations to cache_reap at this time.
The first patch adds a function similiar to schedule_delayed_work to allow
work to be scheduled on another cpu.
The second patch makes use of schedule_delayed_work_on to schedule
cache_reap to run from keventd.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/workqueue.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 987fbc2986d889..3f559661ee19f5 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -398,6 +398,26 @@ int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay return queue_delayed_work(keventd_wq, work, delay); } +int schedule_delayed_work_on(int cpu, + struct work_struct *work, unsigned long delay) +{ + int ret = 0; + struct timer_list *timer = &work->timer; + + if (!test_and_set_bit(0, &work->pending)) { + BUG_ON(timer_pending(timer)); + BUG_ON(!list_empty(&work->entry)); + /* This stores keventd_wq for the moment, for the timer_fn */ + work->wq_data = keventd_wq; + timer->expires = jiffies + delay; + timer->data = (unsigned long)work; + timer->function = delayed_work_timer_fn; + add_timer_on(timer, cpu); + ret = 1; + } + return ret; +} + void flush_scheduled_work(void) { flush_workqueue(keventd_wq); |