public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Andreas Gruenbacher <agruen@suse.de>,
	linux-kernel@vger.kernel.org, manfred@colorfullife.com
Subject: slab-alignment-rework.patch in -mc
Date: Mon, 19 Apr 2004 18:25:33 +0200	[thread overview]
Message-ID: <20040419162533.GR29954@dualathlon.random> (raw)
In-Reply-To: <1082383751.6746.33.camel@f235.suse.de>

/mirror/kernel/people/akpm/patches/2.6/2.6.5/2.6.5-mc4/broken-out/slab-alignment-rework.patch

I don't think this is right:

> -	if (flags & SLAB_HWCACHE_ALIGN) {
> -		/* Need to adjust size so that objs are cache aligned. */
> -		/* Small obj size, can get at least two per cache line. */
> +	if (!align) {
> +		/* Default alignment: compile time specified l1 cache size.
> +		 * Except if an object is really small, then squeeze multiple
> +		 * into one cacheline.
> +		 */
> +		align = cache_line_size();
>  		while (size <= align/2)
>  			align /= 2;
> -		size = (size+align-1)&(~(align-1));
>  	}
> +	size = ALIGN(size, align);
>  

I want anon-vma to really use only 12 bytes, period. No best-guess must
be made automatically by the slab code, rounding it to 16 bytes.

this is not just for anon-vma though. For this specific case it's
absolteuly useless to throw 4 more bytes of ram at every anon-vma, it's
not hw aligned anyways so there will be false sharing anyways, so at the
very least we must try to save ram since we cannot scale the cache anyways.
Other cases for small objects are similar.

Overall I think it's definitely wrong to remove the hw alignment request
from the caller, the hw alignment must be used only where worthwhile.
for vmas and anon-vmas the hw alignment definitely isn't worthwhile and
we must not waste ram like the above patch does.

The other changes like using cache_line_size() is an _obvious_
improvement of course, I'm not commenting that part, but I'd ask to
please rewrite that patch removing the removal of the hw-alignment
parameter dictated by the kmem_cache_create caller.

       reply	other threads:[~2004-04-19 16:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1082383751.6746.33.camel@f235.suse.de>
2004-04-19 16:25 ` Andrea Arcangeli [this message]
2004-04-19 16:42   ` slab-alignment-rework.patch in -mc Manfred Spraul
2004-04-20  0:26     ` Andrea Arcangeli
2004-04-20  7:24     ` Andrew Morton
2004-04-20 14:49       ` Andrea Arcangeli
2004-04-20 17:23         ` Manfred Spraul
2004-04-20 18:25           ` Andrew Morton
2004-04-20 18:52             ` Linus Torvalds
2004-04-21 17:22               ` Manfred Spraul
2004-04-21 21:46                 ` Andrew Morton
2004-04-20 18:53             ` Arjan van de Ven

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=20040419162533.GR29954@dualathlon.random \
    --to=andrea@suse.de \
    --cc=agruen@suse.de \
    --cc=akpm@osdl.org \
    --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