aboutsummaryrefslogtreecommitdiffstats
path: root/net
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 /net
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 'net')
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/link_watch.c5
2 files changed, 5 insertions, 6 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index ab39fe17cb5..195a5e96b2d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2980,7 +2980,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
2980static DEFINE_MUTEX(net_todo_run_mutex); 2980static DEFINE_MUTEX(net_todo_run_mutex);
2981void netdev_run_todo(void) 2981void netdev_run_todo(void)
2982{ 2982{
2983 struct list_head list = LIST_HEAD_INIT(list); 2983 struct list_head list;
2984 2984
2985 /* Need to guard against multiple cpu's getting out of order. */ 2985 /* Need to guard against multiple cpu's getting out of order. */
2986 mutex_lock(&net_todo_run_mutex); 2986 mutex_lock(&net_todo_run_mutex);
@@ -2995,9 +2995,9 @@ void netdev_run_todo(void)
2995 2995
2996 /* Snapshot list, allow later requests */ 2996 /* Snapshot list, allow later requests */
2997 spin_lock(&net_todo_list_lock); 2997 spin_lock(&net_todo_list_lock);
2998 list_splice_init(&net_todo_list, &list); 2998 list_replace_init(&net_todo_list, &list);
2999 spin_unlock(&net_todo_list_lock); 2999 spin_unlock(&net_todo_list_lock);
3000 3000
3001 while (!list_empty(&list)) { 3001 while (!list_empty(&list)) {
3002 struct net_device *dev 3002 struct net_device *dev
3003 = list_entry(list.next, struct net_device, todo_list); 3003 = list_entry(list.next, struct net_device, todo_list);
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 646937cc2d8..0f37266411b 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -91,11 +91,10 @@ static void rfc2863_policy(struct net_device *dev)
91/* Must be called with the rtnl semaphore held */ 91/* Must be called with the rtnl semaphore held */
92void linkwatch_run_queue(void) 92void linkwatch_run_queue(void)
93{ 93{
94 LIST_HEAD(head); 94 struct list_head head, *n, *next;
95 struct list_head *n, *next;
96 95
97 spin_lock_irq(&lweventlist_lock); 96 spin_lock_irq(&lweventlist_lock);
98 list_splice_init(&lweventlist, &head); 97 list_replace_init(&lweventlist, &head);
99 spin_unlock_irq(&lweventlist_lock); 98 spin_unlock_irq(&lweventlist_lock);
100 99
101 list_for_each_safe(n, next, &head) { 100 list_for_each_safe(n, next, &head) {