All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: David Chinner <dgc@sgi.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Lachlan McIlroy <lachlan@sgi.com>, xfs-dev <xfs-dev@sgi.com>,
	xfs-oss <xfs@oss.sgi.com>
Subject: Re: [Patch] Cacheline align xlog_t
Date: Thu, 3 Apr 2008 08:46:08 +0200	[thread overview]
Message-ID: <20080403064608.GS29105@one.firstfloor.org> (raw)
In-Reply-To: <20080402222347.GK103491721@sgi.com>

On Thu, Apr 03, 2008 at 08:23:47AM +1000, David Chinner wrote:
> > For the dynamic allocation you would rather need to make sure it
> > starts at a cache line boundary explicitely because the allocator doesn't
> > know the alignment of the target type, otherwise your careful
> > padding might be useless.
> 
> Yup. Is there an allocator function gives us cacheline aligned
> allocation 

__get_free_pages() @) [ok not serious]

> (apart from a slab initialised with SLAB_HWCACHE_ALIGN)?

That too yes.

> There isn't one, right?

You can always align yourself with kmalloc (or any other arbitary 
size allocator) with the standard technique:
get L1_CACHE_BYTES-1 or possibly better cache_line_size() - 1 bytes
more and then align the pointer manually with ALIGN. Only tricky part
is that you have to undo the alignment before freeing.

-Andi

  reply	other threads:[~2008-04-03  6:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 23:15 [Patch] Cacheline align xlog_t David Chinner
2008-04-02  6:35 ` Lachlan McIlroy
2008-04-02  5:44   ` David Chinner
2008-04-02  8:28     ` Andi Kleen
2008-04-02 22:23       ` David Chinner
2008-04-03  6:46         ` Andi Kleen [this message]
2008-04-04  1:02           ` Timothy Shimmin
2008-04-04  1:18           ` David Chinner

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=20080403064608.GS29105@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=dgc@sgi.com \
    --cc=lachlan@sgi.com \
    --cc=xfs-dev@sgi.com \
    --cc=xfs@oss.sgi.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 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.