lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 28 Apr 2008 17:10:43 +0200
From:	"Alexander van Heukelum" <heukelum@...tmail.fm>
To:	"Thomas Gleixner" <tglx@...utronix.de>,
	"Linus Torvalds" <torvalds@...ux-foundation.org>
Cc:	"Harvey Harrison" <harvey.harrison@...il.com>,
	"Ingo Molnar" <mingo@...e.hu>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"LKML" <linux-kernel@...r.kernel.org>,
	"David Miller" <davem@...emloft.net>
Subject: Re: [PATCH] bitops: simplify generic bit finding functions

> 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@...utronix.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@...utronix.de>
> Acked-by: Ingo Molnar <mingo@...e.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@...r.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@...tmail.fm

-- 
http://www.fastmail.fm - mmm... Fastmail...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ