Skip to content

Commit

Permalink
revert "cpumask: don't perform while loop in cpumask_next_and()"
Browse files Browse the repository at this point in the history
Revert commit 534b483 ("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 <[email protected]>
Reported-by: Peter Zijlstra <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Amir Vadai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
akpm00 authored and torvalds committed Jun 19, 2015
1 parent 17fda38 commit 5ca62d6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/cpumask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5ca62d6

Please sign in to comment.