aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-06-23 05:05:55 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:43:07 -0400
commit626ab0e69d376fa07599af669af8ba92d58e87c1 (patch)
treea995e0231e61fab63568bc7bade81dc20c1dae09 /kernel
parent54e73770357142e297c916c7865f5fca7499f69c (diff)
[PATCH] list: use list_replace_init() instead of list_splice_init()
list_splice_init(list, head) does unneeded job if it is known that list_empty(head) == 1. We can use list_replace_init() instead. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c8
-rw-r--r--kernel/workqueue.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 9e49deed468c..3bf0e9ed2dbe 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -419,10 +419,10 @@ static inline void __run_timers(tvec_base_t *base)
419 419
420 spin_lock_irq(&base->lock); 420 spin_lock_irq(&base->lock);
421 while (time_after_eq(jiffies, base->timer_jiffies)) { 421 while (time_after_eq(jiffies, base->timer_jiffies)) {
422 struct list_head work_list = LIST_HEAD_INIT(work_list); 422 struct list_head work_list;
423 struct list_head *head = &work_list; 423 struct list_head *head = &work_list;
424 int index = base->timer_jiffies & TVR_MASK; 424 int index = base->timer_jiffies & TVR_MASK;
425 425
426 /* 426 /*
427 * Cascade timers: 427 * Cascade timers:
428 */ 428 */
@@ -431,8 +431,8 @@ static inline void __run_timers(tvec_base_t *base)
431 (!cascade(base, &base->tv3, INDEX(1))) && 431 (!cascade(base, &base->tv3, INDEX(1))) &&
432 !cascade(base, &base->tv4, INDEX(2))) 432 !cascade(base, &base->tv4, INDEX(2)))
433 cascade(base, &base->tv5, INDEX(3)); 433 cascade(base, &base->tv5, INDEX(3));
434 ++base->timer_jiffies; 434 ++base->timer_jiffies;
435 list_splice_init(base->tv1.vec + index, &work_list); 435 list_replace_init(base->tv1.vec + index, &work_list);
436 while (!list_empty(head)) { 436 while (!list_empty(head)) {
437 void (*fn)(unsigned long); 437 void (*fn)(unsigned long);
438 unsigned long data; 438 unsigned long data;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 880fb415a8f6..740c5abceb07 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -531,11 +531,11 @@ int current_is_keventd(void)
531static void take_over_work(struct workqueue_struct *wq, unsigned int cpu) 531static void take_over_work(struct workqueue_struct *wq, unsigned int cpu)
532{ 532{
533 struct cpu_workqueue_struct *cwq = per_cpu_ptr(wq->cpu_wq, cpu); 533 struct cpu_workqueue_struct *cwq = per_cpu_ptr(wq->cpu_wq, cpu);
534 LIST_HEAD(list); 534 struct list_head list;
535 struct work_struct *work; 535 struct work_struct *work;
536 536
537 spin_lock_irq(&cwq->lock); 537 spin_lock_irq(&cwq->lock);
538 list_splice_init(&cwq->worklist, &list); 538 list_replace_init(&cwq->worklist, &list);
539 539
540 while (!list_empty(&list)) { 540 while (!list_empty(&list)) {
541 printk("Taking work for %s\n", wq->name); 541 printk("Taking work for %s\n", wq->name);