Commit 8630282070b4a52b12cfa514ba8558e2f3d56360

Authored by Andrew Morton
Committed by Linus Torvalds
1 parent 3d18bd74a2

[PATCH] cpumask: uninline highest_possible_processor_id()

Shrinks the only caller (net/bridge/netfilter/ebtables.c) by 174 bytes.

Also, optimise highest_possible_processor_id() out of existence on
CONFIG_SMP=n.

Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 2 changed files with 23 additions and 9 deletions Side-by-side Diff

include/linux/cpumask.h
... ... @@ -396,6 +396,12 @@
396 396 #define cpu_present(cpu) ((cpu) == 0)
397 397 #endif
398 398  
  399 +#ifdef CONFIG_SMP
  400 +int highest_possible_processor_id(void);
  401 +#else
  402 +#define highest_possible_processor_id() 0
  403 +#endif
  404 +
399 405 #define any_online_cpu(mask) \
400 406 ({ \
401 407 int cpu; \
... ... @@ -408,15 +414,6 @@
408 414 #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409 415 #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
410 416 #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
411   -
412   -/* Find the highest possible smp_processor_id() */
413   -#define highest_possible_processor_id() \
414   -({ \
415   - unsigned int cpu, highest = 0; \
416   - for_each_cpu_mask(cpu, cpu_possible_map) \
417   - highest = cpu; \
418   - highest; \
419   -})
420 417  
421 418  
422 419 #endif /* __LINUX_CPUMASK_H */
... ... @@ -14,4 +14,21 @@
14 14 return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
15 15 }
16 16 EXPORT_SYMBOL(__next_cpu);
  17 +
  18 +/*
  19 + * Find the highest possible smp_processor_id()
  20 + *
  21 + * Note: if we're prepared to assume that cpu_possible_map never changes
  22 + * (reasonable) then this function should cache its return value.
  23 + */
  24 +int highest_possible_processor_id(void)
  25 +{
  26 + unsigned int cpu;
  27 + unsigned highest = 0;
  28 +
  29 + for_each_cpu_mask(cpu, cpu_possible_map)
  30 + highest = cpu;
  31 + return highest;
  32 +}
  33 +EXPORT_SYMBOL(highest_possible_processor_id);