Hello everyone,
I'm studying the SLOB allocator and I'm having a bit of a hard time understanding how slob_page_alloc() works. Particularly, what I don't understand is the structure of a "cleared" linked slob_page. For example, the first slob_page is dedicated for allocations (0, 256B]. Let's assume that no allocations have been done. Then if a single slob_page is 4KiB (2 ^ 12) and each "block" is 2B (2 ^ 2) then are there 2 ^ 10 blocks in that slob_page?
What is also confusing is what the metadata in each free/allocated block represents. If there is allocation request of 64B, that would go into the list of slob_page(s) dedicated to allocations within (0,256B]. The next pointer is pointing to the very first block of the slob_page. What value (in units) does that block have?