Struct page cleanup
Struct page cleanup
Posted May 1, 2018 7:58 UTC (Tue) by Sesse (subscriber, #53779)In reply to: Struct page cleanup by willy
Parent article: Willy's memory-management to-do list
Posted May 1, 2018 11:14 UTC (Tue)
by willy (subscriber, #9762)
[Link] (4 responses)
For the first three tabs, each row represents four bytes. The first row (or two rows for the 64-bit struct page) are 'flags', and each cell represents one bit with a two-letter abbreviation of the name of the flag.
struct page {
so there's a dark line between mapping and index to show that we can't just put a list_head into the union.
Fields which have the same meaning between all page types are shown without vertical lines (eg refcount) while fields which happen to be used for the same meaning between different page types are shown with vertical lines.
Hope that's helpful. Yes, it's a confusing diagram. I spent hours trying to come up with a good graphical representation of what's going on in struct page, and this was the best I could do.
Posted May 1, 2018 11:16 UTC (Tue)
by Sesse (subscriber, #53779)
[Link] (3 responses)
Also, I wonder, why are people all “WE ARE OUT OF PAGE FLAGS” all the time, when there are clearly tons of them left for 64-bit and a bunch even for 32-bit?
Posted May 1, 2018 11:49 UTC (Tue)
by willy (subscriber, #9762)
[Link] (2 responses)
My slot wasn't focused on the flags, so I didn't fill in all the rest of the details; I juts handwaved at it because everybody else in the room knew what other things were in those bits. I've filled in the fields that are commonly stored in those bits; the problem is that they're all dependent on various CONFIG options and I haven't taken the trouble to figure out likely values in order to size the fields to realistic number of bits. If you can make sense of page-flags-layout.h and the rest of the generating machinery, please let me know. The first problem you'll face is that whoever did the ASCII art in those files was a fan of big-endian bit numbering (probably from IBM).
Struct page cleanup
Then there's a row of headers which enumerate some of the users of struct page (page cache, anon, slab, slub, page tables, etc)
At this point the meaning of each cell changes; one cell represents one byte.
The dark lines represent boundaries within the struct page, eg we currently have:
union {
struct address_space *mapping;
/* deferred_list.head */
};
union {
unsigned long index;
/* deferred_list.tail */
};
...
};
Struct page cleanup
Struct page cleanup
