[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>
This commit is contained in:
committed by
Linus Torvalds
parent
54e7377035
commit
626ab0e69d
@ -2980,7 +2980,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
|
||||
static DEFINE_MUTEX(net_todo_run_mutex);
|
||||
void netdev_run_todo(void)
|
||||
{
|
||||
struct list_head list = LIST_HEAD_INIT(list);
|
||||
struct list_head list;
|
||||
|
||||
/* Need to guard against multiple cpu's getting out of order. */
|
||||
mutex_lock(&net_todo_run_mutex);
|
||||
@ -2995,9 +2995,9 @@ void netdev_run_todo(void)
|
||||
|
||||
/* Snapshot list, allow later requests */
|
||||
spin_lock(&net_todo_list_lock);
|
||||
list_splice_init(&net_todo_list, &list);
|
||||
list_replace_init(&net_todo_list, &list);
|
||||
spin_unlock(&net_todo_list_lock);
|
||||
|
||||
|
||||
while (!list_empty(&list)) {
|
||||
struct net_device *dev
|
||||
= list_entry(list.next, struct net_device, todo_list);
|
||||
|
@ -91,11 +91,10 @@ static void rfc2863_policy(struct net_device *dev)
|
||||
/* Must be called with the rtnl semaphore held */
|
||||
void linkwatch_run_queue(void)
|
||||
{
|
||||
LIST_HEAD(head);
|
||||
struct list_head *n, *next;
|
||||
struct list_head head, *n, *next;
|
||||
|
||||
spin_lock_irq(&lweventlist_lock);
|
||||
list_splice_init(&lweventlist, &head);
|
||||
list_replace_init(&lweventlist, &head);
|
||||
spin_unlock_irq(&lweventlist_lock);
|
||||
|
||||
list_for_each_safe(n, next, &head) {
|
||||
|
Reference in New Issue
Block a user