Commit:     17aa3a82aa2173a22405f862c4444656f0494a3f
Parent:     cba684f56d7e8b82b08d4372375a42d6ebeab47d
Author:     Kevin Corry <[EMAIL PROTECTED]>
AuthorDate: Wed Aug 1 06:19:46 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Fri Aug 3 19:36:00 2007 +1000

    [POWERPC] Fix num_cpus calculation in smp_call_function_map()
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Carl Love <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
 arch/powerpc/kernel/smp.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 087c92f..1ea4316 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -212,11 +212,6 @@ int smp_call_function_map(void (*func) (void *info), void 
*info, int nonatomic,
                atomic_set(&data.finished, 0);
-       /* 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) (void *info), void 
*info, int nonatomic,
        /* 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;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to