]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
cpumask: make "nr_cpumask_bits" unsigned
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 8 May 2017 22:56:15 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 May 2017 00:15:11 +0000 (17:15 -0700)
commitc311c797998c1e70eade463dd60b843da4f1a203
treecf20c8c1e2305c3cdc8a7e405fb69f0bc38eedb9
parent19659c59af52df22d1b85208a2c37b2d46290541
cpumask: make "nr_cpumask_bits" unsigned

Bit searching functions accept "unsigned long" indices but
"nr_cpumask_bits" is "int" which is signed, so inevitable sign
extensions occur on x86_64.  Those MOVSX are #1 MOVSX bloat by number of
uses across whole kernel.

Change "nr_cpumask_bits" to unsigned, this number can't be negative
after all.  It allows to do implicit zero-extension on x86_64 without
MOVSX.

Change signed comparisons into unsigned comparisons where necessary.

Other uses looks fine because it is either argument passed to a function
or comparison is already unsigned.

Net win on allyesconfig type of kernel: ~2.8 KB (!)

add/remove: 0/0 grow/shrink: 8/725 up/down: 93/-2926 (-2833)
function                                     old     new   delta
xen_exit_mmap                                691     735     +44
qstat_read                                   426     440     +14
__cpufreq_cooling_register                  1678    1687      +9
trace_rb_cpu_prepare                         447     455      +8
vermagic                                      54      60      +6
nfp_driver_version                            54      60      +6
rcu_torture_stats_print                     1147    1151      +4
find_next_push_cpu                           267     269      +2
xen_irq_resume                               961     960      -1
...
init_vp_index                                946     906     -40
od_set_powersave_bias                        328     281     -47
power_cpu_exit                               193     139     -54
arch_show_interrupts                        3538    3484     -54
select_idle_sibling                         1558    1471     -87
Total: Before=158358910, After=158356077, chg -0.00%

Same arguments apply to "nr_cpu_ids" but I haven't yet found enough
courage to delve into this issue (and proper fix may require new type
"cpu_t" which is whole separate story).

Link: http://lkml.kernel.org/r/20170309205322.GA1728@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/mips/kernel/perf_event_mipsxx.c
arch/s390/kernel/perf_cpum_sf.c
include/linux/cpumask.h