+ mm-slobc-for_each_possible_cpu-not-nr_cpus.patch added to -mm tree

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

 



The patch titled

     mm/slob.c: for_each_possible_cpu(), not NR_CPUS

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

     mm-slobc-for_each_possible_cpu-not-nr_cpus.patch

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


From: John Hawkes <hawkes@xxxxxxx>

Convert for-loops that explicitly reference "NR_CPUS" into the potentially
more efficient for_each_possible_cpu() construct.

Signed-off-by: John Hawkes <hawkes@xxxxxxx>
Cc: Matt Mackall <mpm@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/slob.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff -puN mm/slob.c~mm-slobc-for_each_possible_cpu-not-nr_cpus mm/slob.c
--- 25/mm/slob.c~mm-slobc-for_each_possible_cpu-not-nr_cpus	Thu Apr 13 16:37:04 2006
+++ 25-akpm/mm/slob.c	Thu Apr 13 16:37:04 2006
@@ -354,9 +354,7 @@ void *__alloc_percpu(size_t size)
 	if (!pdata)
 		return NULL;
 
-	for (i = 0; i < NR_CPUS; i++) {
-		if (!cpu_possible(i))
-			continue;
+	for_each_possible_cpu(i) {
 		pdata->ptrs[i] = kmalloc(size, GFP_KERNEL);
 		if (!pdata->ptrs[i])
 			goto unwind_oom;
@@ -383,11 +381,9 @@ free_percpu(const void *objp)
 	int i;
 	struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);
 
-	for (i = 0; i < NR_CPUS; i++) {
-		if (!cpu_possible(i))
-			continue;
+	for_each_possible_cpu(i)
 		kfree(p->ptrs[i]);
-	}
+
 	kfree(p);
 }
 EXPORT_SYMBOL(free_percpu);
_

Patches currently in -mm which might be from hawkes@xxxxxxx are

nfs_show_stats-for_each_possible_cpu-not-nr_cpus.patch
mm-slobc-for_each_possible_cpu-not-nr_cpus.patch
sched-implement-smpnice.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