On Mon, 21 Jul 2014, Nishanth Aravamudan wrote: > Sorry for bringing up this old thread again, but I had a question for > you, David. node_to_mem_node(), which does seem like a useful API, > doesn't seem like it can just node_distance() solely, right? Because > that just tells us the relative cost (or so I think about it) of using > resources from that node. But we also need to know if that node itself > has memory, etc. So using the zonelists is required no matter what? And > upon memory hotplug (or unplug), the topology can change in a way that > affects things, so node online time isn't right either? >
I think there's two use cases of interest: - allocating from a memoryless node where numa_node_id() is memoryless, and - using node_to_mem_node() for a possibly-memoryless node for kmalloc(). I believe the first should have its own node_zonelist[0], whether it's memoryless or not, that points to a list of zones that start with those with the smallest distance. I think its own node_zonelist[1], for __GFP_THISNODE allocations, should point to the node with present memory that has the smallest distance. For sure node_zonelist[0] cannot be NULL since things like first_online_pgdat() would break and it should be unnecessary to do node_to_mem_node() for all allocations when CONFIG_HAVE_MEMORYLESS_NODES since the zonelists should already be defined properly. All nodes, regardless of whether they have memory or not, should probably end up having a struct pglist_data unless there's a reason for another level of indirection. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev