1
0
Fork 0
alistair23-linux/kernel/rcu
Alexey Dobriyan 9b130ad5bb treewide: make "nr_cpu_ids" unsigned
First, number of CPUs can't be negative number.

Second, different signnnedness leads to suboptimal code in the following
cases:

1)
	kmalloc(nr_cpu_ids * sizeof(X));

"int" has to be sign extended to size_t.

2)
	while (loff_t *pos < nr_cpu_ids)

MOVSXD is 1 byte longed than the same MOV.

Other cases exist as well. Basically compiler is told that nr_cpu_ids
can't be negative which can't be deduced if it is "int".

Code savings on allyesconfig kernel: -3KB

	add/remove: 0/0 grow/shrink: 25/264 up/down: 261/-3631 (-3370)
	function                                     old     new   delta
	coretemp_cpu_online                          450     512     +62
	rcu_init_one                                1234    1272     +38
	pci_device_probe                             374     399     +25

				...

	pgdat_reclaimable_pages                      628     556     -72
	select_fallback_rq                           446     369     -77
	task_numa_find_cpu                          1923    1807    -116

Link: http://lkml.kernel.org/r/20170819114959.GA30580@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-09-08 18:26:48 -07:00
..
Kconfig rcu: Drive TASKS_RCU directly off of PREEMPT 2017-08-17 07:26:04 -07:00
Kconfig.debug rcu: Move RCU debug Kconfig options to kernel/rcu 2017-06-08 18:52:44 -07:00
Makefile rcu: Remove debugfs tracing 2017-06-08 18:52:43 -07:00
rcu.h rcu: Move rcu.h to new trivial-function style 2017-08-17 07:26:06 -07:00
rcu_segcblist.c rcu: Remove unused RCU list functions 2017-07-25 13:04:49 -07:00
rcu_segcblist.h rcu: Remove unused RCU list functions 2017-07-25 13:04:49 -07:00
rcuperf.c rcu: Remove CONFIG_TASKS_RCU ifdef from rcuperf.c 2017-07-24 16:04:09 -07:00
rcutorture.c Merge branches 'doc.2017.08.17a', 'fixes.2017.08.17a', 'hotplug.2017.07.25b', 'misc.2017.08.17a', 'spin_unlock_wait_no.2017.08.17a', 'srcu.2017.07.27c' and 'torture.2017.07.24c' into HEAD 2017-08-17 08:10:04 -07:00
srcutiny.c srcu: Move rcu_scheduler_starting() from Tiny RCU to Tiny SRCU 2017-07-24 16:03:22 -07:00
srcutree.c Merge branches 'doc.2017.08.17a', 'fixes.2017.08.17a', 'hotplug.2017.07.25b', 'misc.2017.08.17a', 'spin_unlock_wait_no.2017.08.17a', 'srcu.2017.07.27c' and 'torture.2017.07.24c' into HEAD 2017-08-17 08:10:04 -07:00
sync.c locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write() 2016-08-18 15:36:59 +02:00
tiny.c srcu: Move rcu_scheduler_starting() from Tiny RCU to Tiny SRCU 2017-07-24 16:03:22 -07:00
tree.c treewide: make "nr_cpu_ids" unsigned 2017-09-08 18:26:48 -07:00
tree.h Merge branches 'doc.2017.08.17a', 'fixes.2017.08.17a', 'hotplug.2017.07.25b', 'misc.2017.08.17a', 'spin_unlock_wait_no.2017.08.17a', 'srcu.2017.07.27c' and 'torture.2017.07.24c' into HEAD 2017-08-17 08:10:04 -07:00
tree_exp.h rcu: Make expedited GPs correctly handle hardware CPU insertion 2017-07-25 13:04:45 -07:00
tree_plugin.h treewide: make "nr_cpu_ids" unsigned 2017-09-08 18:26:48 -07:00
update.c rcu: Create reasonable API for do_exit() TASKS_RCU processing 2017-08-17 07:26:05 -07:00