Though all looks good and innocent on the surface, I urge you to delve a bit deeper. Just under the surface, a massive (unpleasant!) surprise might await you: the blissfully unaware kernel/driver developer. The APIs we covered previously regarding the page allocator (see Table 8.1) have the dubious distinction of being able to internally fragment – in simpler terms, waste – very significant portions of kernel memory!
To understand why this is the case, you must understand at least the basics of the page allocator algorithm and its freelist data structures. The section The fundamental workings of the page allocator covered this (just in case you haven't read it, please do so).
In the Working through a few scenarios section, you would have seen that when we make an allocation request of convenient, perfectly rounded power-of-two-size pages, it goes very smoothly. However, when this isn...