From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Andrew Morton <akpm@linux-foundation.org>, Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 0/7] lib: bitmap: Simplify bitmap_shift_{left,right}
Date: Fri, 28 Nov 2014 17:01:03 +0100 [thread overview]
Message-ID: <1417190476-18066-1-git-send-email-linux@rasmusvillemoes.dk> (raw)
I've previously changed the nbits parameter of most bitmap_* functions
to unsigned; now it is bitmap_shift_{left,right}'s turn. This alone
saves some .text, but while at it I found that there were a few other
things one could do. The end result of these seven patches is
$ scripts/bloat-o-meter /tmp/bitmap.o.{old,new}
add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-328 (-328)
function old new delta
__bitmap_shift_right 384 226 -158
__bitmap_shift_left 306 136 -170
and less importantly also a smaller stack footprint
$ stack-o-meter.pl master bitmap
file function old new delta
lib/bitmap.o __bitmap_shift_right 24 8 -16
lib/bitmap.o __bitmap_shift_left 24 0 -24
For each pair of 0 <= shift <= nbits <= 256 I've tested the end result
with a few randomly filled src buffers (including garbage beyond
nbits), in each case verifying that the shift {left,right}-most bits
of dst are zero and the remaining nbits-shift bits correspond to src,
so I'm fairly confident I didn't screw up. That hasn't stopped me from
being wrong before, though.
Rasmus Villemoes (7):
lib: bitmap: Change bitmap_shift_right to take unsigned parameters
lib: bitmap: Eliminate branch in __bitmap_shift_right
lib: bitmap: Remove redundant code from __bitmap_shift_right
lib: bitmap: Yet another simplification in __bitmap_shift_right
lib: bitmap: Change bitmap_shift_left to take unsigned parameters
lib: bitmap: Eliminate branch in __bitmap_shift_left
lib: bitmap: Remove redundant code from __bitmap_shift_left
include/linux/bitmap.h | 24 ++++++++++++------------
lib/bitmap.c | 47 ++++++++++++++++++++---------------------------
2 files changed, 32 insertions(+), 39 deletions(-)
--
2.0.4
next reply other threads:[~2014-11-28 16:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 16:01 Rasmus Villemoes [this message]
2014-11-28 16:01 ` [PATCH 1/7] lib: bitmap: Change bitmap_shift_right to take unsigned parameters Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 2/7] lib: bitmap: Eliminate branch in __bitmap_shift_right Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 3/7] lib: bitmap: Remove redundant code from __bitmap_shift_right Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 4/7] lib: bitmap: Yet another simplification in __bitmap_shift_right Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 5/7] lib: bitmap: Change bitmap_shift_left to take unsigned parameters Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 6/7] lib: bitmap: Eliminate branch in __bitmap_shift_left Rasmus Villemoes
2014-11-28 16:01 ` [PATCH 7/7] lib: bitmap: Remove redundant code from __bitmap_shift_left Rasmus Villemoes
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=1417190476-18066-1-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
/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®