2000-11-07 15:24:47

by Abel Mu?oz Alcaraz

[permalink] [raw]
Subject: A question about memory fragmentation

Hi everybody,
I have a question for you; How Linux avoids the memory fragmentation in
linked lists?

Windows 9x/NT/2000 (sorry, ;-)), have specific functions (like List_Create,
ExInitializeSListHead, ...) to create generic linked lists but I don't find
something similar in Linux.
Has Linux a generic linked list management API ?
Must I develop this?
Is the kernel memory fragmentation a solved problem in Linux? (I wish it).

I have develop my own API but I don't know if Linux can do this for me.

Thanks in advance.

Abel Mu?oz Alcaraz.
Media Security Software Developer.
mailto:[email protected]
Trymedia Systems


2000-11-07 15:28:07

by Alan

[permalink] [raw]
Subject: Re: A question about memory fragmentation

> Has Linux a generic linked list management API ?

Yes - if you want to use it
<linux/list.h>

> Is the kernel memory fragmentation a solved problem in Linux? (I wish =

Its not a problem you can solve without causing serious performance hits so
we don't solve it. If you want to allocate large bus linear memory allocations
then tough 8). If you want large virtually linear blocks then you can use
vmalloc

2000-11-07 15:34:09

by Erik Mouw

[permalink] [raw]
Subject: Re: A question about memory fragmentation

On Tue, Nov 07, 2000 at 04:20:20PM +0100, Abel Mu?oz Alcaraz wrote:
> I have a question for you; How Linux avoids the memory fragmentation in
> linked lists?
>
> Windows 9x/NT/2000 (sorry, ;-)), have specific functions (like List_Create,
> ExInitializeSListHead, ...) to create generic linked lists but I don't find
> something similar in Linux.
> Has Linux a generic linked list management API ?

Yes.

> Must I develop this?

No.

> Is the kernel memory fragmentation a solved problem in Linux? (I wish it).

My guess is that the slab allocator solves this, but I don't know that
much about the MM.

> I have develop my own API but I don't know if Linux can do this for me.

Have a look in include/linux/list.h.

Or install jadetex and the DocBook style sheets and type "make psdocs"
in the kernel tree. That will create the file
Documentation/DocBook/kernel-api.ps in which the linked list API (and
much more) is described.


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/

2000-11-07 15:46:45

by Davide Libenzi

[permalink] [raw]
Subject: Re: A question about memory fragmentation

On Tue, 07 Nov 2000, Erik Mouw wrote:
>
> > Is the kernel memory fragmentation a solved problem in Linux? (I wish it).
>
> My guess is that the slab allocator solves this, but I don't know that
> much about the MM.

Linux lists implementation stores linking informations directly inside the
block of data We're going to link.
This has the advantage that no extra list nodes are allocated to store the data
pointer but has the drawback that if We've to link the same data to more than
one list We've to declare more than one listhead.
See at the different links We've inside the task_struct for example.



- Davide