* Re: RFC: Non Power of 2 memory allocator
[not found] <6.1.1.1.0.20060325090152.01ec63f0@ptg1.spd.analog.com>
@ 2006-03-25 16:21 ` Andi Kleen
2006-03-25 17:51 ` Hugh Dickins
0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2006-03-25 16:21 UTC (permalink / raw)
To: uClinux development list; +Cc: linux-kernel, rgetz
Robin Getz <rgetz@blackfin.uclinux.org> writes:
> The buddy system allocates things in power of 2 pages sizes (4k, 8k,
> 16k, 32k, 64k, 128k, 256k, 512k, 1024k), which works fine on most
> systems, but an embedded system, which is running without a MMU (
> Memory Management Unit) - RAM is precious, and when you only need
> 129k for an application, you don't want to allocate a power of 2,
> which gives you 256k - an extra 127k, which can't be used by
> anything else.
In 2.4 I solved this problem at some point by just returning
the excess pages to the buddy allocator. There was even
a nice function to do this (alloc_exact)
That won't work for slab, but does for __get_free_pages() which
is better for large allocations anyways. slab imho doesn't make
sense for allocation anywhere bigger PAGE_SIZE/2. At some
point in 2.6 there was trouble with "compound pages" but I think
that has been resolved.
Just implementing alloc_exact again would be the simplest solution
for your problem.
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: Non Power of 2 memory allocator
[not found] <mailman.10486.1143303698.3925.uclinux-dev@uclinux.org>
@ 2006-03-25 16:58 ` Andi Kleen
0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2006-03-25 16:58 UTC (permalink / raw)
To: rgetz; +Cc: linux-kernel
On Saturday 25 March 2006 17:21, uclinux-dev-owner@uclinux.org wrote:
> You are not allowed to post to this mailing list, and your message has
> been automatically rejected. If you think that your messages are
> being rejected in error, contact the mailing list owner at
> uclinux-dev-owner@uclinux.org.
P.S.: It is considered quite rude to post with closed lists in Cc
or even reply-to as it was the case here. Don't do that. If you
want comments on your emails please make sure they can be answered
by everybody.
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: Non Power of 2 memory allocator
2006-03-25 16:21 ` Andi Kleen
@ 2006-03-25 17:51 ` Hugh Dickins
2006-03-26 0:32 ` Nick Piggin
0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2006-03-25 17:51 UTC (permalink / raw)
To: rgetz; +Cc: Nick Piggin, Andi Kleen, linux-kernel
On Sat, 25 Mar 2006, Andi Kleen wrote:
> Robin Getz <rgetz@blackfin.uclinux.org> writes:
>
> > The buddy system allocates things in power of 2 pages sizes (4k, 8k,
> > 16k, 32k, 64k, 128k, 256k, 512k, 1024k), which works fine on most
> > systems, but an embedded system, which is running without a MMU (
> > Memory Management Unit) - RAM is precious, and when you only need
> > 129k for an application, you don't want to allocate a power of 2,
> > which gives you 256k - an extra 127k, which can't be used by
> > anything else.
>
> In 2.4 I solved this problem at some point by just returning
> the excess pages to the buddy allocator. There was even
> a nice function to do this (alloc_exact)
>
> That won't work for slab, but does for __get_free_pages() which
> is better for large allocations anyways. slab imho doesn't make
> sense for allocation anywhere bigger PAGE_SIZE/2. At some
> point in 2.6 there was trouble with "compound pages" but I think
> that has been resolved.
>
> Just implementing alloc_exact again would be the simplest solution
> for your problem.
Nick has put a split_page function into the 2.6.16-git mm/page_alloc.c,
which I believe is supposed to be a helper in this kind of operation.
You'd best take a look at where and how it's used. Perhaps Andi's
alloc_exact should be reimplemented in terms of it.
Hugh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: Non Power of 2 memory allocator
2006-03-25 17:51 ` Hugh Dickins
@ 2006-03-26 0:32 ` Nick Piggin
0 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2006-03-26 0:32 UTC (permalink / raw)
To: Hugh Dickins; +Cc: rgetz, Andi Kleen, linux-kernel
Hugh Dickins wrote:
> On Sat, 25 Mar 2006, Andi Kleen wrote:
>
>>Robin Getz <rgetz@blackfin.uclinux.org> writes:
>>
>>
>>>The buddy system allocates things in power of 2 pages sizes (4k, 8k,
>>>16k, 32k, 64k, 128k, 256k, 512k, 1024k), which works fine on most
>>>systems, but an embedded system, which is running without a MMU (
>>>Memory Management Unit) - RAM is precious, and when you only need
>>>129k for an application, you don't want to allocate a power of 2,
>>>which gives you 256k - an extra 127k, which can't be used by
>>>anything else.
>>
>>In 2.4 I solved this problem at some point by just returning
>>the excess pages to the buddy allocator. There was even
>>a nice function to do this (alloc_exact)
>>
>>That won't work for slab, but does for __get_free_pages() which
>>is better for large allocations anyways. slab imho doesn't make
>>sense for allocation anywhere bigger PAGE_SIZE/2. At some
>>point in 2.6 there was trouble with "compound pages" but I think
>>that has been resolved.
>>
>>Just implementing alloc_exact again would be the simplest solution
>>for your problem.
>
>
> Nick has put a split_page function into the 2.6.16-git mm/page_alloc.c,
> which I believe is supposed to be a helper in this kind of operation.
> You'd best take a look at where and how it's used. Perhaps Andi's
> alloc_exact should be reimplemented in terms of it.
>
Indeed. nommu already uses the slab allocator for user allocations.
I guess the problem is that slab probably doesn't do this exact
allocation thing either.
I'd like to see nommu move over to using something like Andi's
alloc_exact (away from slab), because that's how the normal
kernel does it.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-26 0:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.10486.1143303698.3925.uclinux-dev@uclinux.org>
2006-03-25 16:58 ` RFC: Non Power of 2 memory allocator Andi Kleen
[not found] <6.1.1.1.0.20060325090152.01ec63f0@ptg1.spd.analog.com>
2006-03-25 16:21 ` Andi Kleen
2006-03-25 17:51 ` Hugh Dickins
2006-03-26 0:32 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox