From: "Alexander van Heukelum" <heukelum@fastmail.fm>
To: "Thomas Gleixner" <tglx@linutronix.de>,
"Linus Torvalds" <torvalds@linux-foundation.org>
Cc: "Harvey Harrison" <harvey.harrison@gmail.com>,
"Ingo Molnar" <mingo@elte.hu>,
"Andrew Morton" <akpm@linux-foundation.org>,
"LKML" <linux-kernel@vger.kernel.org>,
"David Miller" <davem@davemloft.net>
Subject: Re: [PATCH] bitops: simplify generic bit finding functions
Date: Mon, 28 Apr 2008 17:10:43 +0200 [thread overview]
Message-ID: <1209395443.25700.1250273669@webmail.messagingengine.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0804281534530.3261@apollo.tec.linutronix.de>
> See patch below. It gives back the 1400 bytes on SPARC64 and other
> platforms that have no instruction for find bit.
Hi,
I, personally, see this patch as a stopgap measure. The real problem
is that the generic __ffs is inlined and ends up generating a lot
of instructions.
Until the generic implementation of __ffs is fixed not to be an
enormous inline function, this seems to be a reasonable thing
to do, though it's a shame that the optimization is now default-
off for architectures with a good implementation of __ffs.
Greetings,
Alexander
> Thanks,
> tglx
>
> ---------->
>
> Subject: bitops: optional bitops mapsize optimization on config switch
> From: Thomas Gleixner <tglx@linutronix.de>
> Date: Mon, 28 Apr 2008 00:22:06 +0200
>
> The mapsize optimizations which were moved from x86 to the generic
> code in commit 64970b68d2b3ed32b964b0b30b1b98518fde388e increased the
> binary size on non x86 architectures.
>
> Make the optimization depend on a config switch so architecture
> maintainers can decide.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Acked-by: Ingo Molnar <mingo@elte.hu>
>
> ---
> arch/x86/Kconfig.cpu | 1 +
> include/linux/bitops.h | 6 ++++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/arch/x86/Kconfig.cpu
> ===================================================================
> --- linux-2.6.orig/arch/x86/Kconfig.cpu
> +++ linux-2.6/arch/x86/Kconfig.cpu
> @@ -282,6 +282,7 @@ config X86_CPU
> def_bool y
> select GENERIC_FIND_FIRST_BIT
> select GENERIC_FIND_NEXT_BIT
> + select GENERIC_FIND_BIT_MAPSIZE_OPTIMIZE
>
> config X86_GENERIC
> bool "Generic x86 support"
> Index: linux-2.6/include/linux/bitops.h
> ===================================================================
> --- linux-2.6.orig/include/linux/bitops.h
> +++ linux-2.6/include/linux/bitops.h
> @@ -190,6 +190,7 @@ static __always_inline unsigned long
> find_next_bit(const unsigned long *addr, unsigned long size,
> unsigned long offset)
> {
> +#ifdef CONFIG_GENERIC_FIND_BIT_MAPSIZE_OPTIMIZE
> unsigned long value;
>
> /* Avoid a function call if the bitmap size is a constant */
> @@ -209,7 +210,7 @@ find_next_bit(const unsigned long *addr,
> value = (*addr) & ((~0ul) << offset);
> return (value == 0) ? BITS_PER_LONG : __ffs(value);
> }
> -
> +#endif
> /* size is not constant or too big */
> return __find_next_bit(addr, size, offset);
> }
> @@ -227,6 +228,7 @@ static __always_inline unsigned long
> find_next_zero_bit(const unsigned long *addr, unsigned long size,
> unsigned long offset)
> {
> +#ifdef CONFIG_GENERIC_FIND_BIT_MAPSIZE_OPTIMIZE
> unsigned long value;
>
> /* Avoid a function call if the bitmap size is a constant */
> @@ -246,7 +248,7 @@ find_next_zero_bit(const unsigned long *
> value = (~(*addr)) & ((~0ul) << offset);
> return (value == 0) ? BITS_PER_LONG : __ffs(value);
> }
> -
> +#endif
> /* size is not constant or too big */
> return __find_next_zero_bit(addr, size, offset);
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
--
Alexander van Heukelum
heukelum@fastmail.fm
--
http://www.fastmail.fm - mmm... Fastmail...
next prev parent reply other threads:[~2008-04-28 15:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-27 20:19 [PATCH] bitops: simplify generic bit finding functions Harvey Harrison
2008-04-27 20:26 ` Linus Torvalds
2008-04-27 20:29 ` Harvey Harrison
2008-04-27 20:36 ` Al Viro
2008-04-27 20:38 ` Harvey Harrison
2008-04-27 20:38 ` Linus Torvalds
2008-04-27 21:02 ` Al Viro
2008-04-28 14:04 ` Thomas Gleixner
2008-04-28 15:10 ` Alexander van Heukelum [this message]
2008-04-28 15:58 ` Thomas Gleixner
2008-04-28 16:25 ` Linus Torvalds
2008-04-28 16:47 ` Thomas Gleixner
2008-04-28 16:54 ` Linus Torvalds
2008-04-28 19:26 ` Thomas Gleixner
2008-04-28 19:37 ` Linus Torvalds
2008-04-28 21:55 ` Ingo Molnar
2008-04-29 10:01 ` [PATCH] bitops: remove "optimizations" Thomas Gleixner
2008-04-29 10:03 ` David Miller
2008-04-29 12:34 ` David Miller
2008-04-29 14:20 ` Ingo Molnar
2008-04-29 22:31 ` David Miller
2008-04-29 16:51 ` Thomas Gleixner
2008-04-29 22:58 ` David Miller
2008-04-29 23:30 ` David Miller
2008-04-28 19:57 ` [PATCH] bitops: simplify generic bit finding functions Andi Kleen
2008-04-28 14:58 ` Alexander van Heukelum
2008-04-28 14:32 ` Alexander van Heukelum
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=1209395443.25700.1250273669@webmail.messagingengine.com \
--to=heukelum@fastmail.fm \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=harvey.harrison@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.