On Tue, Sep 03, 2019 at 12:15:24PM +0000, Salil Mehta wrote: > > From: Linuxarm [mailto:linuxarm-boun...@huawei.com] On Behalf Of Peter > > Zijlstra > > On Tue, Sep 03, 2019 at 02:19:04PM +0800, Yunsheng Lin wrote:
> > > Is it possible that the node id set by device_add() become invalid > > > if the node is offlined, then dev_to_node() may return a invalid > > > node id. > > > > In that case I would expect the device to go away too. Once the memory > > controller goes away, the PCI bus connected to it cannot continue to > > function. > > I am not sure if this is *exactly* true on our system as NUMA nodes are > part of the SoCs and devices could still be used even if all the memory > and CPUs part of the node are turned off. Although, it is highly unlikely > anybody would do that(maybe could be debated for the Power Management case?) Cute; anyway, we never change nr_node_ids (after boot), so once a node is deemed valid it always is. The worst that can happen in the above case, is that cpumask_of_node() returns an empty mask, which, if all CPUs (of said node) are offline, is an accurate representation.