Introducing kernel memory allocators
Dynamically allocating, and subsequently freeing, kernel memory – both physical and virtual – is the key topic area here. The Linux kernel, like any other OS, requires a sturdy algorithm and implementation to perform this really key task. The primary (de)allocator engine in the Linux OS is referred to as the PA, or the BSA. Internally, it uses a so-called buddy system algorithm to efficiently organize and parcel out free chunks of system RAM. You will find more on the algorithm in the Understanding and using the kernel page allocator (or BSA) section of this chapter.
In this chapter and throughout this book, when we use the notation (de)allocate, please read it as both words: allocate and deallocate.
Of course, being imperfect, the page allocator is not the only or always the best way to obtain and subsequently release system memory. Other technologies exist within the Linux kernel to do so. High on the list of...