So far, you have learned some key points:
- The page (or buddy system) allocator allocates power-of-2 pages to the caller. The power to raise 2 to is called the order; it typically ranges from 0 to 10 (on both x86[_64] and ARM).
- This is fine, except when it's not. When the amount of memory requested is very small, the wastage (or internal fragmentation) can be huge.
- Requests for fragments of a page (less than 4,096 bytes) are very common. Thus, the slab allocator, layered upon the page allocator (see Figure 8.1) is designed with object caches, as well as small generic memory caches, to efficiently fulfill requests for small amounts of memory.
- The page allocator guarantees physically contiguous page and cacheline-aligned memory.
- The slab allocator guarantees physically contiguous and cacheline-aligned memory.
So, fantastic – this leads us to conclude that when the amount of memory required...