From: Andrew Morton Date: Thu, 18 Jun 2015 18:01:11 +0000 (-0700) Subject: revert "cpumask: don't perform while loop in cpumask_next_and()" X-Git-Tag: v4.1~6 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=5ca62d65030d8295f54c490d2072563545dbd9d9;p=cascardo%2Flinux.git revert "cpumask: don't perform while loop in cpumask_next_and()" Revert commit 534b483a86e6 ("cpumask: don't perform while loop in cpumask_next_and()"). This was a minor optimization, but it puts a `struct cpumask' on the stack, which consumes too much stack space. Sergey Senozhatsky Reported-by: Peter Zijlstra Cc: Sergey Senozhatsky Cc: Tejun Heo Cc: "David S. Miller" Cc: Amir Vadai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/cpumask.c b/lib/cpumask.c index 5f627084f2e9..5a70f6196f57 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -16,11 +16,10 @@ int cpumask_next_and(int n, const struct cpumask *src1p, const struct cpumask *src2p) { - struct cpumask tmp; - - if (cpumask_and(&tmp, src1p, src2p)) - return cpumask_next(n, &tmp); - return nr_cpu_ids; + while ((n = cpumask_next(n, src1p)) < nr_cpu_ids) + if (cpumask_test_cpu(n, src2p)) + break; + return n; } EXPORT_SYMBOL(cpumask_next_and);