Look closely at the preceding screenshot (Figure 8.12; here, we will simply ignore the kernel diagnostics emitted by the WARN() macro, which got invoked because a kernel-level memory allocation failed!). The Figure 8.12 output has five columns, as follows:
- The timestamp from dmesg(1); we ignore it.
- kmalloc(n): The number of bytes requested by kmalloc() (where n is the required amount).
- The actual number of bytes allocated by the slab allocator (revealed via ksize()).
- The wastage (bytes): The difference between the actual and required bytes.
- The wastage as a percentage.
As an example, in the second allocation, we requested 200,100 bytes, but actually obtained 262,144 bytes (256 KB). This makes sense, as this is the precise size of one of the page allocator lists on a buddy system freelist (it's order 6, as 26 = 64 pages = 64 x 4 = 256 KB; see Figure 8.2). Hence, the delta, or wastage...