+ powerpc-fix-num_cpus-calculation-in-smp_call_function_map.patch added to -mm tree

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

 



The patch titled
     PowerPC: Fix num_cpus calculation in smp_call_function_map()
has been added to the -mm tree.  Its filename is
     powerpc-fix-num_cpus-calculation-in-smp_call_function_map.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

------------------------------------------------------
Subject: PowerPC: Fix num_cpus calculation in smp_call_function_map()
From: Kevin Corry <kevcorry@xxxxxxxxxx>

In smp_call_function_map(), num_cpus is set to the number of online CPUs
minus one.  However, if the CPU mask does not include all CPUs (except the
one we're running on), the routine will hang in the first while() loop
until the 8 second timeout occurs.

The num_cpus should be set to the number of CPUs specified in the mask
passed into the routine, after we've made any modifications to the mask. 
With this change, we can also get rid of the call to cpus_empty() and avoid
adding another pass through the bitmask.

Signed-off-by: Kevin Corry <kevcorry@xxxxxxxxxx>
Signed-off-by: Carl Love <carll@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/powerpc/kernel/smp.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff -puN arch/powerpc/kernel/smp.c~powerpc-fix-num_cpus-calculation-in-smp_call_function_map arch/powerpc/kernel/smp.c
--- a/arch/powerpc/kernel/smp.c~powerpc-fix-num_cpus-calculation-in-smp_call_function_map
+++ a/arch/powerpc/kernel/smp.c
@@ -212,11 +212,6 @@ int smp_call_function_map(void (*func) (
 		atomic_set(&data.finished, 0);
 
 	spin_lock(&call_lock);
-	/* Must grab online cpu count with preempt disabled, otherwise
-	 * it can change. */
-	num_cpus = num_online_cpus() - 1;
-	if (!num_cpus)
-		goto done;
 
 	/* remove 'self' from the map */
 	if (cpu_isset(smp_processor_id(), map))
@@ -224,7 +219,9 @@ int smp_call_function_map(void (*func) (
 
 	/* sanity check the map, remove any non-online processors. */
 	cpus_and(map, map, cpu_online_map);
-	if (cpus_empty(map))
+
+	num_cpus = cpus_weight(map);
+	if (!num_cpus)
 		goto done;
 
 	call_data = &data;
_

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

powerpc-fix-num_cpus-calculation-in-smp_call_function_map.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