public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* virtually and physically (page) aligned allocation
@ 2009-02-24  4:55 Parav Pandit
  2009-02-24  6:32 ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Parav Pandit @ 2009-02-24  4:55 UTC (permalink / raw)
  To: Linux kernel


Hi,

Can user space application allocate memory which is virtually and physically aligned to the system's page boundary in the Linux 2.6.x?
Such as using posix_memalign().

In other way,
If user space application allocates memory which is aligned to page boundary for say 4 pages using posix_memalign(), will is ensure that it corresponds to exactly 4 physical pages in kernel which can be pinned down?

Regards,
Parav Pandit


      

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: virtually and physically (page) aligned allocation
  2009-02-24  4:55 virtually and physically (page) aligned allocation Parav Pandit
@ 2009-02-24  6:32 ` H. Peter Anvin
  2009-02-24 23:48   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: H. Peter Anvin @ 2009-02-24  6:32 UTC (permalink / raw)
  To: Parav Pandit; +Cc: Linux kernel

Parav Pandit wrote:
> Hi,
> 
> Can user space application allocate memory which is virtually and physically aligned to the system's page boundary in the Linux 2.6.x?
> Such as using posix_memalign().
> 
> In other way,
> If user space application allocates memory which is aligned to page boundary for say 4 pages using posix_memalign(), will is ensure that it corresponds to exactly 4 physical pages in kernel which can be pinned down?
> 

You can use hugetlbfs to allocate a 2 MB page, otherwise no.

	-hpa


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: virtually and physically (page) aligned allocation
  2009-02-24  6:32 ` H. Peter Anvin
@ 2009-02-24 23:48   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2009-02-24 23:48 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Parav Pandit, Linux kernel

On Tuesday 24 February 2009, H. Peter Anvin wrote:
> Parav Pandit wrote:
> > In other way,
> > If user space application allocates memory which is aligned to page
> > boundary for say 4 pages using posix_memalign(), will is ensure that
> > it corresponds to exactly 4 physical pages in kernel which can be pinned down?  
> > 
> 
> You can use hugetlbfs to allocate a 2 MB page, otherwise no.

Well, posix_memalign should be able to give you alignment of up to page size
in real addresses (which I think is what Parav was asking for), but can not
guarantee larger than page size real alignment.

If an address is page aligned in user space, it is also guaranteed to be
page aligned in real storage. Alignment larger than page size can not be
forced or detected in user space except when using hugetlbfs.

	Arnd <><

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-24 23:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-24  4:55 virtually and physically (page) aligned allocation Parav Pandit
2009-02-24  6:32 ` H. Peter Anvin
2009-02-24 23:48   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox