Re: buddy system

From: chrismiceli (chrismiceli_at_excite.com)
Date: 03/17/04


Date: 17 Mar 2004 05:57:02 -0800

Kasper Dupont <kasperd@daimi.au.dk> wrote in message news:<4057F932.865F8398@daimi.au.dk>...
> chrismiceli wrote:
> >
> > I am reading "Understanding the Linux Kernel" (2nd edition) and they
> > are describing the buddy system for allocating contiguous blocks of
> > memory. I mustn't be grasping the system, could someone explain it to
> > me. A good resource would be nice as well describing the buddy system.
> > Thanx in advanced.
>
> It is quite simple. Memory allocation is done in
> chunks of 2^n pages of alligned memory. Where n
> can be anything from 0 to some upper limit.
>
> There is a free list for each n, and each time a
> chunk has been released, there is exactly one
> possible other chunk of the same size it could be
> joined with.
>
> In case there is no free chunks of a specific size,
> a larger allocation can be split in two.

I get the concept, but when I look at the code given in the book, I
can't follow it. Particularly the rmqueue function. I understand the
alloc_pages function. Now that I look at the 2.4.26 src, I see the
code is different than the book, I will try to understand this one,
but any further explanation on these functions could be helpful.
Thanx.



Relevant Pages

  • Re: buddy system
    ... A good resource would be nice as well describing the buddy system. ... Memory allocation is done in ... In case there is no free chunks of a specific size, ... a larger allocation can be split in two. ...
    (comp.os.linux.development.system)
  • Memory allocation on Windows XP
    ... I am working on an app that need a lot of memory. ... This is probably due to the pattern of memory allocation I use. ... Basically the app allocates small chunks and large chunks of memory, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: buddy system
    ... >> memory. ... A good resource would be nice as well describing the buddy system. ... > In case there is no free chunks of a specific size, ... > a larger allocation can be split in two. ...
    (comp.os.linux.development.system)
  • Re: How Much..??
    ... Does it return only the amont requested or it returns memory in by ... The user process gets address space for allocation from ... the kernel in hardware page size chunks. ... For more information, get a book on Linux kernel, e.g. ...
    (comp.os.linux.misc)
  • Re: [00/41] Large Blocksize Support V7 (adds memmap support)
    ... I'm assuming that when an unmovable allocation hijacks a movable group ... the most successful attack will like mmapa 60K ... To block the last of those 16k chunks all previous 8k chunks ... about) of memory first. ...
    (Linux-Kernel)