From: Eric Dumazet <dada1@cosmosbay.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
Miklos Szeredi <miklos@szeredi.hu>,
nickpiggin@yahoo.com.au, hugh@veritas.com, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org
Subject: Re: SLUB defrag pull request?
Date: Thu, 23 Oct 2008 19:14:23 +0200 [thread overview]
Message-ID: <4900B0EF.2000108@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0810231145430.19239@quilx.com>
[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]
Christoph Lameter a écrit :
> On Thu, 23 Oct 2008, Eric Dumazet wrote:
>
>>> SLUB touches objects by default when allocating. And it does it
>>> immediately in slab_alloc() in order to retrieve the pointer to the
>>> next object. So there is no point of hinting there right now.
>>>
>>
>> Please note SLUB touches by reading object.
>>
>> prefetchw() gives a hint to cpu saying this cache line is going to be
>> *modified*, even
>> if first access is a read. Some architectures can save some bus
>> transactions, acquiring
>> the cache line in an exclusive way instead of shared one.
>
> Most architectures actually can do that. Its probably worth to run some
> tests with that. Conversion of a cacheline from shared to exclusive can
> cost something.
>
Please check following patch as a followup
[PATCH] slub: slab_alloc() can use prefetchw()
Most kmalloced() areas are initialized/written right after allocation.
prefetchw() gives a hint to cpu saying this cache line is going to be
*modified*, even if first access is a read.
Some architectures can save some bus transactions, acquiring
the cache line in an exclusive way instead of shared one.
Same optimization was done in 2005 on SLAB in commit
34342e863c3143640c031760140d640a06c6a5f8
([PATCH] mm/slab.c: prefetchw the start of new allocated objects)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: slub.patch --]
[-- Type: text/plain, Size: 585 bytes --]
diff --git a/mm/slub.c b/mm/slub.c
index 0c83e6a..c2017a3 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1592,13 +1592,14 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
local_irq_save(flags);
c = get_cpu_slab(s, smp_processor_id());
+ object = c->freelist;
+ prefetchw(object);
objsize = c->objsize;
- if (unlikely(!c->freelist || !node_match(c, node)))
+ if (unlikely(!object || !node_match(c, node)))
object = __slab_alloc(s, gfpflags, node, addr, c);
else {
- object = c->freelist;
c->freelist = object[c->offset];
stat(c, ALLOC_FASTPATH);
}
next prev parent reply other threads:[~2008-10-23 17:18 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1223883004.31587.15.camel@penberg-laptop>
[not found] ` <1223883164.31587.16.camel@penberg-laptop>
[not found] ` <Pine.LNX.4.64.0810131227120.20511@blonde.site>
2008-10-13 12:54 ` SLUB defrag pull request? Nick Piggin
2008-10-13 12:54 ` Nick Piggin
2008-10-13 13:59 ` Miklos Szeredi
2008-10-13 13:59 ` Miklos Szeredi
2008-10-13 14:27 ` Miklos Szeredi
2008-10-13 14:27 ` Miklos Szeredi
2008-10-13 16:35 ` Christoph Lameter
2008-10-13 16:35 ` Christoph Lameter
2008-10-13 14:49 ` Miklos Szeredi
2008-10-13 14:49 ` Miklos Szeredi
2008-10-13 15:22 ` Miklos Szeredi
2008-10-13 15:22 ` Miklos Szeredi
2008-10-20 14:59 ` Christoph Lameter
2008-10-20 14:59 ` Christoph Lameter
2008-10-20 18:01 ` Miklos Szeredi
2008-10-20 18:01 ` Miklos Szeredi
2008-10-20 18:22 ` Christoph Lameter
2008-10-20 18:22 ` Christoph Lameter
2008-10-20 18:40 ` Miklos Szeredi
2008-10-20 18:40 ` Miklos Szeredi
2008-10-20 19:11 ` Christoph Lameter
2008-10-20 19:11 ` Christoph Lameter
2008-10-20 19:28 ` Miklos Szeredi
2008-10-20 19:28 ` Miklos Szeredi
2008-10-20 19:53 ` Christoph Lameter
2008-10-20 19:53 ` Christoph Lameter
2008-10-20 20:50 ` Miklos Szeredi
2008-10-20 20:50 ` Miklos Szeredi
2008-10-21 23:17 ` Christoph Lameter
2008-10-21 23:17 ` Christoph Lameter
2008-10-22 7:10 ` Miklos Szeredi
2008-10-22 7:10 ` Miklos Szeredi
2008-10-22 15:42 ` Christoph Lameter
2008-10-22 15:42 ` Christoph Lameter
2008-10-22 19:46 ` Miklos Szeredi
2008-10-22 19:46 ` Miklos Szeredi
2008-10-22 19:54 ` Christoph Lameter
2008-10-22 19:54 ` Christoph Lameter
2008-10-22 20:11 ` Miklos Szeredi
2008-10-22 20:11 ` Miklos Szeredi
2008-10-22 20:19 ` Christoph Lameter
2008-10-22 20:19 ` Christoph Lameter
2008-10-22 20:26 ` Miklos Szeredi
2008-10-22 20:26 ` Miklos Szeredi
2008-10-22 20:48 ` Pekka Enberg
2008-10-22 20:48 ` Pekka Enberg
2008-10-22 21:01 ` Christoph Lameter
2008-10-22 21:01 ` Christoph Lameter
2008-10-22 21:04 ` Miklos Szeredi
2008-10-22 21:04 ` Miklos Szeredi
2008-10-22 21:12 ` Pekka Enberg
2008-10-22 21:12 ` Pekka Enberg
2008-10-22 21:28 ` Christoph Lameter
2008-10-22 21:28 ` Christoph Lameter
2008-10-22 22:10 ` Miklos Szeredi
2008-10-22 22:10 ` Miklos Szeredi
2008-10-22 23:20 ` Christoph Lameter
2008-10-22 23:20 ` Christoph Lameter
2008-10-23 7:10 ` Pekka Enberg
2008-10-23 7:10 ` Pekka Enberg
2008-10-23 7:10 ` Pekka Enberg
2008-10-23 8:38 ` Miklos Szeredi
2008-10-23 8:38 ` Miklos Szeredi
2008-10-23 8:38 ` Miklos Szeredi
2008-10-23 13:40 ` Christoph Lameter
2008-10-23 13:40 ` Christoph Lameter
2008-10-23 13:58 ` Pekka Enberg
2008-10-23 13:58 ` Pekka Enberg
2008-10-23 14:09 ` Christoph Lameter
2008-10-23 14:09 ` Christoph Lameter
2008-10-23 14:14 ` Pekka Enberg
2008-10-23 14:14 ` Pekka Enberg
2008-10-23 14:25 ` Christoph Lameter
2008-10-23 14:25 ` Christoph Lameter
2008-10-23 15:17 ` Eric Dumazet
2008-10-23 15:17 ` Eric Dumazet
2008-10-23 15:17 ` Eric Dumazet
2008-10-23 15:39 ` Christoph Lameter
2008-10-23 15:39 ` Christoph Lameter
2008-10-23 16:35 ` Eric Dumazet
2008-10-23 16:35 ` Eric Dumazet
2008-10-23 16:35 ` Eric Dumazet
2008-10-23 16:47 ` Christoph Lameter
2008-10-23 16:47 ` Christoph Lameter
2008-10-23 17:14 ` Eric Dumazet [this message]
2008-10-28 11:06 ` Pekka Enberg
2008-10-28 11:06 ` Pekka Enberg
2008-10-28 11:19 ` Nick Piggin
2008-10-28 11:19 ` Nick Piggin
2008-10-30 15:45 ` Christoph Lameter
2008-10-30 15:45 ` Christoph Lameter
2008-10-22 20:59 ` Christoph Lameter
2008-10-22 20:59 ` Christoph Lameter
2008-10-20 23:04 ` Dave Chinner
2008-10-20 23:04 ` Dave Chinner
2008-10-13 16:24 ` Christoph Lameter
2008-10-13 16:24 ` Christoph Lameter
2008-10-13 14:28 ` Miklos Szeredi
2008-10-13 14:28 ` Miklos Szeredi
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=4900B0EF.2000108@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=miklos@szeredi.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=penberg@cs.helsinki.fi \
/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.