4mb PAGES for mbuf clusters

Matthew Dillon dillon at apollo.backplane.com
Sun Jul 15 13:46:46 PDT 2007

:To avoid memory fragmentation what I am thinking is that at system
:startup reserve two memory pools for mbufs and use just one of them.
:When it becomes fragmented (upto 80% or user configurable), switch to
:the next one and recover the fragmented memory. However, this may not
:be a general solution but at least it may work for specific workloads.

     This only works if the memory allocations are temporary.  Unfortunately,
     many memory allocations are persistent.  Without a way to reallocate
     the persistent store there is no way to undo the fragmentation.

     Reallocation is often integrated into high level interpreted
     languages through the means of a double indirect.  That is,
     instead of holding a pointer to something you hold a pointer to a
     pointer to something.  That way the 'something' can be reallocated
     by just changing the underlying pointer and not all the active
     references.  But doing this imposes fairly severe overheads unsuitable
     for kernel code as well as locking issues.

     In absence of that you either have to pre-reserve the memory for
     use ONLY as 4MB pages, which is easy to do but almost impossible to
     balance, or there needs to be a mechanism whereby individual subsystems
     can reallocate memory for active structures - something very difficult
     to do properly.

					Matthew Dillon 
					<dillon at backplane.com>

More information about the Kernel mailing list