From: Manfred Spraul <manfred@colorfullife.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH,RFC] faster kmalloc lookup
Date: Sun, 27 Oct 2002 11:08:48 +0100 [thread overview]
Message-ID: <3DBBBB30.20409@colorfullife.com> (raw)
In-Reply-To: 1035671412.13032.125.camel@irongate.swansea.linux.org.uk
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
Alan Cox wrote:
>On Sat, 2002-10-26 at 20:22, Manfred Spraul wrote:
>
>
>>kmalloc spends a large part of the total execution time trying to find
>>the cache for the passed in size.
>>
>>What about the attached patch (against 2.5.44-mm5)?
>>It uses fls jump over the caches that are definitively too small.
>>
>>
>
>Out of curiousity how does fls compare with finding the right cache by
>using a binary tree walk ? A lot of platforms seem to use generic_fls
>which has a lot of conditions in it and also a lot of references to just
>computed values that look likely to stall
>
>
Binary tree walk means 4 unpredictable branches and at least i386 can
use bsrl for a fast fls().
Patch is attached.
--
Manfred
[-- Attachment #2: patch-fls --]
[-- Type: text/plain, Size: 449 bytes --]
--- 2.5/include/asm-i386/bitops.h Sun Sep 22 06:25:12 2002
+++ build-2.5/include/asm-i386/bitops.h Sun Oct 27 11:04:57 2002
@@ -414,11 +414,22 @@
return word;
}
-/*
+/**
* fls: find last bit set.
+ * @x: The word to search
+ *
*/
-#define fls(x) generic_fls(x)
+static inline int fls(int x)
+{
+ int r;
+
+ __asm__("bsrl %1,%0\n\t"
+ "jnz 1f\n\t"
+ "movl $-1,%0\n"
+ "1:" : "=r" (r) : "g" (x));
+ return r+1;
+}
#ifdef __KERNEL__
next prev parent reply other threads:[~2002-10-27 10:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-26 19:22 [PATCH,RFC] faster kmalloc lookup Manfred Spraul
2002-10-26 22:30 ` Alan Cox
2002-10-27 10:08 ` Manfred Spraul [this message]
2002-10-27 13:29 ` Manfred Spraul
2002-10-28 13:05 ` Nikita Danilov
2002-10-28 13:18 ` Marcus Alanen
2002-10-28 13:26 ` Nikita Danilov
2002-10-28 16:03 ` Manfred Spraul
2002-10-31 9:35 ` Arjan van de Ven
2002-10-31 23:03 ` Manfred Spraul
[not found] <3DBAEB64.1090109@colorfullife.com.suse.lists.linux.kernel>
[not found] ` <1036056917.2872.0.camel@dhcp59-228.rdu.redhat.com.suse.lists.linux.kernel>
[not found] ` <3DC1B6D0.8050202@colorfullife.com.suse.lists.linux.kernel>
2002-11-01 8:03 ` Andi Kleen
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=3DBBBB30.20409@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=alan@lxorguk.ukuu.org.uk \
--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 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.