public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] kernel/cpu.c: eliminate some indirection
@ 2015-09-25 18:22 Rasmus Villemoes
  2015-09-25 18:22 ` [PATCH 1/5] kernel/cpu.c: change type of cpu_possible_bits and friends Rasmus Villemoes
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Rasmus Villemoes @ 2015-09-25 18:22 UTC (permalink / raw)
  To: Thomas Gleixner, Oleg Nesterov, Paul E. McKenney, Rusty Russell,
	Greg Kroah-Hartman
  Cc: Rasmus Villemoes, linux-kernel

Maybe third time's the charm...

The four cpumasks cpu_{possible,online,present,active}_bits are
exposed readonly via the corresponding const variables
cpu_xyz_mask. But they are also accessible for arbitrary writing via
the exposed functions set_cpu_xyz. There's quite a bit of code
throughout the kernel which iterates over or otherwise accesses these
bitmaps, and having the access go via the cpu_xyz_mask variables is
simply a useless indirection.

It may be that any problem in CS can be solved by an extra level of
indirection, but that doesn't mean every extra indirection solves a
problem. In this case, it even necessitates some minor ugliness (see
3/5).

The first four patches eliminate the cpu_xyz_mask variables by simply
exposing the actual bitmaps, after renaming them to discourage direct
access - that still happens through cpu_xyz_mask, which are now simply
macros with the same type and value as they used to have.

After that, there's no longer any reason to have the setter functions
be out-of-line: The boolean parameter is almost always a literal true
or false, so by making them static inlines they will usually compile
to one or two instructions.

For a defconfig build, bloat-o-meter says we save ~3000 bytes.

Rasmus Villemoes (5):
  kernel/cpu.c: change type of cpu_possible_bits and friends
  kernel/cpu.c: export __cpu_*_mask
  drivers/base/cpu.c: use __cpu_*_mask directly
  kernel/cpu.c: eliminate cpu_*_mask
  kernel/cpu.c: make set_cpu_* static inlines

 drivers/base/cpu.c      | 10 ++++----
 include/linux/cpumask.h | 55 +++++++++++++++++++++++++++++++++++-------
 kernel/cpu.c            | 64 ++++++++++---------------------------------------
 3 files changed, 65 insertions(+), 64 deletions(-)

-- 
2.1.3


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-04 19:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-25 18:22 [PATCH 0/5] kernel/cpu.c: eliminate some indirection Rasmus Villemoes
2015-09-25 18:22 ` [PATCH 1/5] kernel/cpu.c: change type of cpu_possible_bits and friends Rasmus Villemoes
2015-09-25 18:22 ` [PATCH 2/5] kernel/cpu.c: export __cpu_*_mask Rasmus Villemoes
2015-09-25 18:22 ` [PATCH 3/5] drivers/base/cpu.c: use __cpu_*_mask directly Rasmus Villemoes
2015-10-04 19:09   ` Greg Kroah-Hartman
2015-09-25 18:22 ` [PATCH 4/5] kernel/cpu.c: eliminate cpu_*_mask Rasmus Villemoes
2015-09-28  6:02   ` kbuild test robot
2015-09-28  6:39     ` Rasmus Villemoes
2015-09-25 18:22 ` [PATCH 5/5] kernel/cpu.c: make set_cpu_* static inlines Rasmus Villemoes
2015-09-27  6:31 ` [PATCH 0/5] kernel/cpu.c: eliminate some indirection Rusty Russell
2015-09-28  6:21   ` Rasmus Villemoes
2015-09-28 21:44     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox