lkml.org 
[lkml]   [2011]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] make new alloc_pages_exact()
From
Date
On Wed, 2011-04-27 at 16:30 -0500, Timur Tabi wrote:
> Dave Hansen wrote:
> > What I really wanted in the end was a highmem-capable
> > alloc_pages_exact(), so here it is. This function can be used to
> > allocate unmapped (like highmem) non-power-of-two-sized areas of
> > memory. This is in constast to get_free_pages_exact() which can only
> > allocate from lowmem.
>
> Is there an easy way to verify that alloc_pages_exact(5MB) really does allocate
> only 5MB and not 8MB?

I'm not sure why you're asking. How do we know that the _normal_
allocator only gives us 4k when we ask for 4k? Well, that's just how it
works. If alloc_pages_exact() returns success, you know it's got the
amount of memory that you asked for, and only that plus a bit of masking
for page alignment.

Have you seen alloc_pages_exact() behaving in some other way?

> Is there some kind of function that returns the amount of
> unallocated memory, so I can do a diff?

Nope. Even if there was, it would be worthless. Calls to this might
also cause the system to swap or reclaim memory, so you might end up
with the same amount of free memory before and after the call.

-- Dave



\
 
 \ /
  Last update: 2011-04-27 23:39    [from the cache]
©2003-2011 Jasper Spaans