From: Suresh Siddha <suresh.b.siddha@intel.com>
To: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: "hpa@zytor.com" <hpa@zytor.com>, "mingo@elte.hu" <mingo@elte.hu>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@linux.jf.intel.com>
Subject: Re: [patch 1/2] bootmem: add alloc_bootmem_align()
Date: Tue, 16 Nov 2010 16:06:50 -0800 [thread overview]
Message-ID: <1289952410.2683.38.camel@sbsiddha-MOBL3.sc.intel.com> (raw)
In-Reply-To: <4CE30244.6090208@linux.intel.com>
On Tue, 2010-11-16 at 14:14 -0800, H. Peter Anvin wrote:
> On 11/16/2010 01:23 PM, Suresh Siddha wrote:
> > Index: tree/include/linux/bootmem.h
> > ===================================================================
> > --- tree.orig/include/linux/bootmem.h
> > +++ tree/include/linux/bootmem.h
> > @@ -105,6 +105,8 @@ extern void *__alloc_bootmem_low_node(pg
> >
> > #define alloc_bootmem(x) \
> > __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> > +#define alloc_bootmem_align(x, align) \
> > + __alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS))
> > #define alloc_bootmem_nopanic(x) \
> > __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> > #define alloc_bootmem_pages(x) \
>
> [...]
>
> > */
> > - init_xstate_buf = alloc_bootmem(xstate_size);
> > + init_xstate_buf = alloc_bootmem_align(xstate_size,
> > + __alignof__(struct xsave_struct));
> > init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT;
>
> Perhaps it would make even more sense to have:
>
> #define alloc_bootmem_alignof(x, type) \
> __alloc_bootmem(x, __alignof__(type), __pa(MAX_DMA_ADDRESS))
>
Wanted to keep it broad so that more people can start using it.
For example, most of the current x86 uses of alloc_bootmem_pages() (or
the __alloc_bootmem() calls in other architectures) can be replaced with
alloc_bootmem_align() and most of them don't have a relevant type to
describe the alignment.
thanks,
suresh
next prev parent reply other threads:[~2010-11-17 0:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 21:23 [patch 1/2] bootmem: add alloc_bootmem_align() Suresh Siddha
2010-11-16 21:23 ` [patch 2/2] xsave: use alloc_bootmem_align() instead of alloc_bootmem() Suresh Siddha
2010-12-14 0:49 ` [tip:x86/urgent] x86, xsave: Use " tip-bot for Suresh Siddha
2010-11-16 22:14 ` [patch 1/2] bootmem: add alloc_bootmem_align() H. Peter Anvin
2010-11-17 0:06 ` Suresh Siddha [this message]
2010-12-14 0:48 ` [tip:x86/urgent] bootmem: Add alloc_bootmem_align() tip-bot for Suresh Siddha
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=1289952410.2683.38.camel@sbsiddha-MOBL3.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=hpa@linux.intel.com \
--cc=hpa@linux.jf.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).