mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Hemment <markhe@veritas.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Q: explicit alignment control for the slab allocator
Date: Fri, 2 Mar 2001 10:59:53 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.21.0103021040100.11260-100000@alloc> (raw)
In-Reply-To: <3A9EC563.C450FAD3@colorfullife.com>


On Thu, 1 Mar 2001, Manfred Spraul wrote:
> Yes, I see the difference, but I'm not sure that it will work as
> intended.
> offset must be a multiple of the alignment, everything else won't work.

  The code does force the offset to be a multiple of the alignment -
rounding the offset up.  The idea was to a caller could something like;
	kmem_cache_create("foo", sizeof(foo_s),
			  offsetoff(foo_s, member), ....);

where structure members in foo_s are "hot" up until the 'member'
structure.

> In which cases an offset > alignment is really a win?

  You've got me. :)  I don't know.
  In the Bonwick paper, such a facility was described, so I thought "hey,
sounds like that might be useful".
  Could be a win on archs with small L1 cache line sizes (16bytes on a
486) - but most modern processors have larger lines.
  Hmm, no that note, seen the L1 line size defined for a Pentium IIII?
128 bytes!! (CONFIG_X86_L1_CACHE_SHIFT of 7).  That is probably going to
waste a lot of space for small objects.


> Obviously using offset 32 bytes for a structure with a 64 byte hot zone
> means that 2 slabs with a different "color" compete for the same cache
> lines [just assuming 32 byte cache lines for simplicity] in 50% of the
> cases, but otoh offset==64 halfs the number of possible colors.

  Yes.
  It is possibly to improve on the current slab allocator, to get an
extra colour or two out of it for some object sizes (eg. when the slab
management is on slab, it is only ever at the front of a slab - it could
also wrap round to the rear).

Mark


  reply	other threads:[~2001-03-02 10:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-01 17:26 Manfred Spraul
2001-03-01 18:09 ` Mark Hemment
2001-03-01 19:55   ` Manfred Spraul
2001-03-01 20:28     ` Mark Hemment
2001-03-01 21:55       ` Manfred Spraul
2001-03-02 10:59         ` Mark Hemment [this message]
2001-03-02 11:51           ` Manfred Spraul
2001-03-02 12:39             ` Mark Hemment
2001-03-02 13:22               ` Manfred Spraul
2001-03-07 20:02     ` Jes Sorensen
2001-03-07 20:32       ` Manfred Spraul
2001-03-08 17:30         ` Jes Sorensen
2001-03-01 19:22 ` David S. Miller
2001-03-01 19:47   ` Manfred Spraul

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=Pine.LNX.4.21.0103021040100.11260-100000@alloc \
    --to=markhe@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®