archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <>
To: Manfred Spraul <>
Cc: Ed Tomlinson <>,
Subject: Re: [patch 3/4] slab reclaim balancing
Date: Thu, 26 Sep 2002 14:39:19 -0700	[thread overview]
Message-ID: <> (raw)

Manfred Spraul wrote:
> Andrew Morton wrote:
> >
> > Was the microbenchmark actually touching the memory which it was
> > allocating from slab?  If so then yes, we'd expect to see cache
> > misses against those cold pages coming out of the buddy.
> >
> No, it was just measuring the cost of the kmem_cache_grow/shrink.
> Btw, 140 cycles for kmem_cache_alloc+free is inflated - someone enabled
> kmem_cache_alloc_head() even in the no-debugging version.
> As expected, done by Andrea, who neither bothered to cc me, nor actually
> understood the code.

hm, OK.  Sorry, I did not realise that you were this closely
interested/involved with slab, so things have been sort of
going on behind your back :(

> >
> >>For SMP and slabs that are per-cpu cached, the change could be right,
> >>because the arrays should absorb bursts. But I do not think that the
> >>change is the right approach for UP.
> >
> >
> > I'd suggest that we wait until we have slab freeing its pages into
> > the hotlists, and allocating from them.  That should pull things back.
>  >
> You are asking a interesting question:
> The slab is by design far from LIFO - it tries to find pages with no
> allocated objects, that are possible to return to the page allocator. It
> doesn't try to optimize for cache hit rates.
> Is that actually the right approach? For large objects, it would be
> possible to cripple the freeable slabs list, and to perform the cache
> hit optimization (i.e. per-cpu LIFO) in page_alloc.c, but that doesn't
> work with small objects.

Well with a, what? 100:1 speed ratio, we'll generally get best results
from optimising for locality/recency of reference.

> On SMP, the per-cpu arrays are the LIFO and should give good cache hit
> rates. On UP, I haven't enabled them, because they could increase the
> internal fragmentation of the slabs.
> Perhaps we should enable the arrays on UP, too, and thus improve the
> cache hit rates? If there is no increase in fragmentation, we could
> ignore it. Otherwise we could replace the 3-list Bonwick slab with
> another backend, something that's stronger at reducing the internal
> fragmentation.

Definitely worthy of investigation.  Memory sizes are increasing,
and the cached-versus-noncached latencies are increasing.  Both
these say "optimise for cache hits".

Plus we'd lose a ton of ifdefs if we enabled it on UP as well...

Bill wrote a couple of handy slab-monitoring tools, btw. - I use bloatmeter.

  reply	other threads:[~2002-09-26 21:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-26 14:13 [patch 3/4] slab reclaim balancing Manfred Spraul
2002-09-26 14:20 ` William Lee Irwin III
2002-09-26 15:24   ` Manfred Spraul
2002-09-26 17:37 ` Andrew Morton
2002-09-26 18:47   ` Manfred Spraul
2002-09-26 19:49     ` Andrew Morton
2002-09-26 20:49       ` Manfred Spraul
2002-09-26 21:39         ` Andrew Morton [this message]
2002-09-27  0:41           ` Ed Tomlinson
2002-09-27 17:24             ` Manfred Spraul
2002-09-27 18:26               ` Andrew Morton
2002-09-27 19:38                 ` Manfred Spraul
2002-09-27 19:52                   ` Andrew Morton
2002-09-27 15:59           ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2002-09-26  4:08 Andrew Morton
2002-09-26 11:39 ` Ed Tomlinson
2002-09-26 15:09 ` Ed Tomlinson

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).