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]
Message-Id: <1208680941.5276.1248837773@webmail.messagingengine.com>
Date:	Sun, 20 Apr 2008 10:42:21 +0200
From:	"Alexander van Heukelum" <heukelum@...tmail.fm>
To:	"Joe Perches" <joe@...ches.com>,
	"Matti Aarnio" <matti.aarnio@...iler.org>
Cc:	"Harvey Harrison" <harvey.harrison@...il.com>,
	"Alexander van Heukelum" <heukelum@...lshack.com>,
	"LKML" <linux-kernel@...r.kernel.org>
Subject: Re: Alternative implementation of the generic __ffs

On Sat, 19 Apr 2008 20:06:57 -0700, "Joe Perches" <joe@...ches.com>
said:
> On Sun, 2008-04-20 at 01:29 +0300, Matti Aarnio wrote:
> > I am curious, why not take the code already in glibc ffs() for ARM ?
> > That is, if the ffs() is all that important detail in kernel ?

Hi,

The glibc version is based on a table-lookup. This makes it
behave differently in hot and cold cache situations. That's
fine if __ffs is used in tight loops, but in the kernel such
use of __ffs is avoided because it might be slow. I added it
to the benchmark, but it would need testing for the cold
cache case too.

As for the importance of __ffs in the kernel: as far as I
know the hot-spots in the kernel using __ffs are the
schedular (sched_find_first_bit) and the cpu mask walking
code (for_each_cpu_mask).

Greetings,
    Alexander

> Here's test results with the glibc ffs implementation.
> (small const is still using slower add rather than or)

Added, thanks.

> $ gcc -Os -fomit-frame-pointer ffs.c
> $ ./a.out
> Original:       3155 tics,  8331 tics
> New:            4211 tics,  8793 tics
> Smallest:       4019 tics,  7754 tics
> Small const:    3552 tics,  6308 tics
> glibc:          2816 tics,  6911 tics
> Empty loop:     1516 tics,  2244 tics
> 
> $ gcc -O2 -fomit-frame-pointer ffs.c
> $ ./a.out
> Original:       3155 tics,  7828 tics
> New:            4792 tics,  8825 tics
> Smallest:       4401 tics,  7155 tics
> Small const:    3539 tics,  5805 tics
> glibc:          2720 tics,  7061 tics
> Empty loop:     1516 tics,  2148 tics
> 
> $ gcc -O3 -fomit-frame-pointer ffs.c
> $ ./a.out
> Original:       3080 tics,  7706 tics
> New:            4721 tics,  8663 tics
> Smallest:       4334 tics,  7116 tics
> Small const:    3466 tics,  5672 tics
> glibc:          2649 tics,  6939 tics
> Empty loop:     1444 tics,  2012 tics
> 
> 
-- 
  Alexander van Heukelum
  heukelum@...tmail.fm

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

--
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