next up previous contents index
Next: 7. Non-Contiguous Memory Allocation Up: 6. Physical Page Allocation Previous: 6.5 GFP Flags   Contents   Index

6.6 Avoiding Fragmentation

One important problem that must be addressed with any allocator is the problem of internal and external fragmentation. External fragmentation is the inability to service a request because the available memory exists only in small blocks. Internal fragmentation is defined as the wasted space where a large block had to be assigned to service a small request. In Linux, external fragmentation is not a serious problem as large requests for contiguous pages are rare and usually vmalloc (See Chapter 7) is sufficient to service the request. The lists of free blocks ensure that large blocks do not have to be split unnecessarily.

Internal fragmentation is the single most serious failing of the binary buddy system. While fragmentation is expected to be in the region of 28%[#!wilson95!#], it has been shown that it can be in the region of 60%, in comparison to just 1% with the first fit allocator[#!johnstone98!#]. It has also been shown that using variations of the buddy system will not help the situation significantly[#!peterson77!#]. To address this problem, Linux uses a slab allocator[#!bonwick94!#] to carve up pages into small blocks of memory for allocation [#!tanenbaum01!#]. With this combination of allocators, the kernel can ensure that the amount of memory wasted due to internal fragmentation is kept to a minimum.


next up previous contents index
Next: 7. Non-Contiguous Memory Allocation Up: 6. Physical Page Allocation Previous: 6.5 GFP Flags   Contents   Index
Mel 2003-01-14