mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Ingo Molnar <mingo@kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] kernel/cpu.c: eliminate some indirection
Date: Thu,  7 May 2015 00:52:49 +0200	[thread overview]
Message-ID: <1430952775-4266-1-git-send-email-linux@rasmusvillemoes.dk> (raw)

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.

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.

Altogether, bloat-o-meter reports a saving of ~2600 bytes.

Rasmus Villemoes (5):
  kernel/cpu.c: change type of cpu_possible_bits and friends
  kernel/cpu.c: export __cpu_xyz_mask
  drivers/base/cpu.c: use __cpu_xyz_mask directly
  kernel/cpu.c: eliminate cpu_xyz_mask
  kernel/cpu.c: make set_cpu_xyz 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


             reply	other threads:[~2015-05-06 22:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 22:52 Rasmus Villemoes [this message]
2015-05-06 22:52 ` [PATCH 1/5] kernel/cpu.c: change type of cpu_possible_bits and friends Rasmus Villemoes
2015-05-06 22:52 ` [PATCH 2/5] kernel/cpu.c: export __cpu_xyz_mask Rasmus Villemoes
2015-05-06 22:52 ` [PATCH 3/5] drivers/base/cpu.c: use __cpu_xyz_mask directly Rasmus Villemoes
2015-05-06 22:52 ` [PATCH 4/5] kernel/cpu.c: eliminate cpu_xyz_mask Rasmus Villemoes
2015-05-06 22:52 ` [PATCH 5/5] kernel/cpu.c: make set_cpu_xyz static inlines Rasmus Villemoes
2015-06-11  9:31 ` [PATCH 0/5] kernel/cpu.c: eliminate some indirection Rasmus Villemoes
2015-09-25 18:22 Rasmus Villemoes
2015-09-27  6:31 ` Rusty Russell
2015-09-28  6:21   ` Rasmus Villemoes
2015-09-28 21:44     ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430952775-4266-1-git-send-email-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®