+ list-use-list_replace_init-instead-of-list_splice_init.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     list: use list_replace_init() instead of list_splice_init()

has been added to the -mm tree.  Its filename is

     list-use-list_replace_init-instead-of-list_splice_init.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Oleg Nesterov <oleg@xxxxxxxxxx>

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@xxxxxxxxxx>
Acked-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/i386/mm/pageattr.c |    8 ++++----
 block/ll_rw_blk.c       |    5 ++---
 fs/aio.c                |    4 ++--
 kernel/timer.c          |    8 ++++----
 kernel/workqueue.c      |    4 ++--
 net/core/dev.c          |    6 +++---
 net/core/link_watch.c   |    5 ++---
 7 files changed, 19 insertions(+), 21 deletions(-)

diff -puN arch/i386/mm/pageattr.c~list-use-list_replace_init-instead-of-list_splice_init arch/i386/mm/pageattr.c
--- devel/arch/i386/mm/pageattr.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/arch/i386/mm/pageattr.c	2006-05-18 01:26:32.000000000 -0700
@@ -209,19 +209,19 @@ int change_page_attr(struct page *page, 
 }
 
 void global_flush_tlb(void)
-{ 
-	LIST_HEAD(l);
+{
+	struct list_head l;
 	struct page *pg, *next;
 
 	BUG_ON(irqs_disabled());
 
 	spin_lock_irq(&cpa_lock);
-	list_splice_init(&df_list, &l);
+	list_replace_init(&df_list, &l);
 	spin_unlock_irq(&cpa_lock);
 	flush_map();
 	list_for_each_entry_safe(pg, next, &l, lru)
 		__free_page(pg);
-} 
+}
 
 #ifdef CONFIG_DEBUG_PAGEALLOC
 void kernel_map_pages(struct page *page, int numpages, int enable)
diff -puN block/ll_rw_blk.c~list-use-list_replace_init-instead-of-list_splice_init block/ll_rw_blk.c
--- devel/block/ll_rw_blk.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/block/ll_rw_blk.c	2006-05-18 01:26:32.000000000 -0700
@@ -3365,12 +3365,11 @@ EXPORT_SYMBOL(end_that_request_chunk);
  */
 static void blk_done_softirq(struct softirq_action *h)
 {
-	struct list_head *cpu_list;
-	LIST_HEAD(local_list);
+	struct list_head *cpu_list, local_list;
 
 	local_irq_disable();
 	cpu_list = &__get_cpu_var(blk_cpu_done);
-	list_splice_init(cpu_list, &local_list);
+	list_replace_init(cpu_list, &local_list);
 	local_irq_enable();
 
 	while (!list_empty(&local_list)) {
diff -puN fs/aio.c~list-use-list_replace_init-instead-of-list_splice_init fs/aio.c
--- devel/fs/aio.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/fs/aio.c	2006-05-18 01:26:32.000000000 -0700
@@ -777,11 +777,11 @@ out:
 static int __aio_run_iocbs(struct kioctx *ctx)
 {
 	struct kiocb *iocb;
-	LIST_HEAD(run_list);
+	struct list_head run_list;
 
 	assert_spin_locked(&ctx->ctx_lock);
 
-	list_splice_init(&ctx->run_list, &run_list);
+	list_replace_init(&ctx->run_list, &run_list);
 	while (!list_empty(&run_list)) {
 		iocb = list_entry(run_list.next, struct kiocb,
 			ki_run_list);
diff -puN kernel/timer.c~list-use-list_replace_init-instead-of-list_splice_init kernel/timer.c
--- devel/kernel/timer.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/kernel/timer.c	2006-05-18 01:26:32.000000000 -0700
@@ -415,10 +415,10 @@ static inline void __run_timers(tvec_bas
 
 	spin_lock_irq(&base->lock);
 	while (time_after_eq(jiffies, base->timer_jiffies)) {
-		struct list_head work_list = LIST_HEAD_INIT(work_list);
+		struct list_head work_list;
 		struct list_head *head = &work_list;
  		int index = base->timer_jiffies & TVR_MASK;
- 
+
 		/*
 		 * Cascade timers:
 		 */
@@ -427,8 +427,8 @@ static inline void __run_timers(tvec_bas
 				(!cascade(base, &base->tv3, INDEX(1))) &&
 					!cascade(base, &base->tv4, INDEX(2)))
 			cascade(base, &base->tv5, INDEX(3));
-		++base->timer_jiffies; 
-		list_splice_init(base->tv1.vec + index, &work_list);
+		++base->timer_jiffies;
+		list_replace_init(base->tv1.vec + index, &work_list);
 		while (!list_empty(head)) {
 			void (*fn)(unsigned long);
 			unsigned long data;
diff -puN kernel/workqueue.c~list-use-list_replace_init-instead-of-list_splice_init kernel/workqueue.c
--- devel/kernel/workqueue.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/kernel/workqueue.c	2006-05-18 01:26:32.000000000 -0700
@@ -531,11 +531,11 @@ int current_is_keventd(void)
 static void take_over_work(struct workqueue_struct *wq, unsigned int cpu)
 {
 	struct cpu_workqueue_struct *cwq = per_cpu_ptr(wq->cpu_wq, cpu);
-	LIST_HEAD(list);
+	struct list_head list;
 	struct work_struct *work;
 
 	spin_lock_irq(&cwq->lock);
-	list_splice_init(&cwq->worklist, &list);
+	list_replace_init(&cwq->worklist, &list);
 
 	while (!list_empty(&list)) {
 		printk("Taking work for %s\n", wq->name);
diff -puN net/core/dev.c~list-use-list_replace_init-instead-of-list_splice_init net/core/dev.c
--- devel/net/core/dev.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/net/core/dev.c	2006-05-18 01:26:32.000000000 -0700
@@ -3020,7 +3020,7 @@ static void netdev_wait_allrefs(struct n
 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);
@@ -3035,9 +3035,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);
diff -puN net/core/link_watch.c~list-use-list_replace_init-instead-of-list_splice_init net/core/link_watch.c
--- devel/net/core/link_watch.c~list-use-list_replace_init-instead-of-list_splice_init	2006-05-18 01:26:32.000000000 -0700
+++ devel-akpm/net/core/link_watch.c	2006-05-18 01:26:32.000000000 -0700
@@ -91,11 +91,10 @@ static void rfc2863_policy(struct net_de
 /* 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) {
_

Patches currently in -mm which might be from oleg@xxxxxxxxxx are

avoid-tasklist_lock-at-getrusage-for-multithreaded-case-too.patch
ptrace-document-the-locking-rules.patch
when-config_base_samll=1-the-kernel-261611-cascade-in-kernel-timerc-may-enter-the-infinite-loop.patch
list-introduce-list_replace-helper.patch
list-use-list_replace_init-instead-of-list_splice_init.patch
proc-remove-tasklist_lock-from-proc_pid_readdir-simply-fix-first_tgid.patch
proc-dont-lock-task_structs-indefinitely.patch
proc-dont-lock-task_structs-indefinitely-task_mmu-small-fixes.patch
simplify-fix-first_tid.patch
cleanup-next_tid.patch
de_thread-fix-lockless-do_each_thread.patch
coredump-optimize-mm-users-traversal.patch
coredump-speedup-sigkill-sending.patch
coredump-kill-ptrace-related-stuff.patch
coredump-kill-ptrace-related-stuff-fix.patch
coredump-dont-take-tasklist_lock.patch
coredump-some-code-relocations.patch
coredump-shutdown-current-process-first.patch
coredump-copy_process-dont-check-signal_group_exit.patch
pidhash-temporary-debug-checks.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux