Understanding and using the kernel page allocator (or BSA)
In this section, you will learn about two aspects of the Linux kernel’s primary (de)allocator engine, the page allocator (or BSA):
- First, we will cover the fundamentals of the algorithm behind this software (called the “buddy system”).
- Secondly, we will cover the actual and practical usage of the APIs it exposes to the kernel or driver developer.
Understanding the basics of the algorithm behind the page allocator is important. You will then be able to understand the pros and cons of it, and thus, when and which APIs to use in which situation. Let’s begin with its inner workings. Again, remember that the scope of this book with regard to the internal memory management details is limited. We shall cover it to a depth deemed sufficient for a typical module/driver author and no more.
The fundamental workings of the page allocator
We will break up this discussion into...