On Wed, Oct 13, 2021 at 02:08:57PM -0400, Johannes Weiner wrote: > Btw, I think slab_nid() is an interesting thing when it comes to page > polymorphy. We want to know the nid for all sorts of memory types: > slab, file, anon, buddy etc. In the goal of distilling page down to > the fewest number of bytes, this is probably something that should > remain in the page rather than be replicated in all subtypes. Oh, this is a really interesting point. Node ID is typically 10 bits (I checked Debian & Oracle configs for various architectures). That's far more than we can store in the bottom bits of a single word, and it's even a good chunk of a second word. I was assuming that, for the page allocator's memory descriptor and for that of many allocators (such as slab), it would be stored *somewhere* in the memory descriptor. It wouldn't necessarily have to be the same place for all memory descriptors, and maybe (if it's accessed rarely), we delegate finding it to the page allocator's knowledge. But not all memory descriptors want/need/can know this. For example, vmalloc() might well spread its memory across multiple nodes. As long as we can restore the node assignment again once the pages are vfree(), there's no particular need for the vmalloc memory descriptor to know what node an individual page came from (and the concept of asking vmalloc what node a particular allocation came from is potentially nonsense, unless somebody used vmalloc_node() or one of the variants). Not sure there's an obviously right answer here. I was assuming that at first we'd enforce memdesc->flags being the first word of every memory descriptor and so we could keep passing page->flags around. That could then change later, but it'd be a good first step?