Re: [RFC v2 4/4] mm: fallback for offline nodes in alloc_pages_node

From: Vlastimil Babka
Date: Mon Jul 27 2015 - 07:29:52 EST


On 07/25/2015 01:06 AM, David Rientjes wrote:
On Fri, 24 Jul 2015, Vlastimil Babka wrote:

Because I didn't think you would suggest the "nid = numa_mem_id()" for
!node_online(nid) fixup would happen only for CONFIG_DEBUG_VM kernels. But it
seems that you do suggest that? I would understand if the fixup (correcting an
offline node to some that's online) was done regardless of DEBUG_VM, and
DEBUG_VM just switched between silent and noisy fixup. But having a debug option
alter the outcome seems wrong?

Hmm, not sure why this is surprising, I don't expect people to deploy
production kernels with CONFIG_DEBUG_VM enabled, it's far too expensive.
I was expecting they would enable it for, well... debug :)

But is there any other place that does such thing for debug builds?

In that case, if nid is a valid node but offline, then the nid =
numa_mem_id() fixup seems fine to allow the kernel to continue debugging.

When a node is offlined as a result of memory hotplug, the pgdat doesn't
get freed so it can be onlined later. Thus, alloc_pages_node() with an
offline node and !CONFIG_DEBUG_VM may not panic. If it does, this can
probably be removed because we're covered.

I've checked, but can't say I understand the hotplug code completely... but it seems there are two cases
- the node was never online, and the nid passed to alloc_pages_node() is clearly bogus. Then there's no pgdat and it should crash on NULL pointer dereference. VM_WARN_ON() in __alloc_pages_node() will already catch this and provide more details as to what caused the crash. Fixup would allow "continue debugging", but it seems that having configured e.g. a crashdump to inspect is a better way to debug than letting the kernel continue?
- the node has been online in the past, so the nid pointing to an offline node might be due to a race with offlining. It shouldn't crash, and most likely the zonelist that is left untouched by the offlining (AFAICS) will allow fallback to other nodes. Unless there is a nodemask of __GFP_THIS_NODE, in which case allocation fails. Again, VM_WARN_ON() in __alloc_pages_node() will warn us already. I doubt the fixup is needed here?

So I would just drop this patch. We already have the debug warning in __alloc_pages_node(), and a fixup is imho just confusing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/