mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Manfred Spraul <manfred@colorfullife.com>,
	andrea@suse.de, agruen@suse.de, linux-kernel@vger.kernel.org
Subject: Re: slab-alignment-rework.patch in -mc
Date: Tue, 20 Apr 2004 11:52:14 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0404201146560.1775@ppc970.osdl.org> (raw)
In-Reply-To: <20040420112556.400ea49e.akpm@osdl.org>



On Tue, 20 Apr 2004, Andrew Morton wrote:
> 
> But why would you choose to make the "SLAB_HWCACHE_ALIGN clear" case use
> sizeof(void*) rather than sizeof(int)?

Because a lot of architectures will cause unaligned faults on structures 
that have pointers (or long's) in them if they are only aligned to "int"?

So "int"-aligned is no better than "char" alignment.

I suspect we should make the "minimum normal alignment" be architecture-
dependent, since some architectures can have even stricter requirements
(ie they may have compilers that assume 64-bit alignment for doing things
like multi-word loads).

My suggestion:

 - if explicit alignment is passed in (non-zero), always use that. The 
   user knows best.

   This allows a user to specify unaligned ("byte alignment", aka
   "align=1") if he wants to.

 - if the passed-in alignment was zero, use a CPU-specific alignment which 
   will depend on SLAB_HWCACHE_ALIGN, and will _usually_ be something like

	align = (flags & SLAB_HWCACHE_ALIGN) ? cachelinesize : sizeof(ptr);

   but some architecture might choose to do something different here.

Wouldn't that make everybody happy.

			Linus

  reply	other threads:[~2004-04-20 18:52 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
2004-04-19 16:42   ` 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 [this message]
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=Pine.LNX.4.58.0404201146560.1775@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=agruen@suse.de \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --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®