Re: [PATCH] pci: derive nearby CPUs from device's instead of bus'NUMA information

From: Jesse Barnes
Date: Mon Apr 20 2009 - 16:03:56 EST


On Mon, 20 Apr 2009 10:47:47 +0200
Andreas Herrmann <andreas.herrmann3@xxxxxxx> wrote:

> On Fri, Apr 17, 2009 at 12:26:54PM -0700, Yinghai Lu wrote:
> > On Fri, Apr 17, 2009 at 9:21 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
> > > const struct cpumask * cpumask_of_pcidev(struct pci_dev *dev)
> > > {
> > > Â Â Â Âif (dev->numa_node == -1)
> > > Â Â Â Â Â Â Â Âreturn cpumask_of_pcibus(to_pci_dev(dev)->bus);
> > >
> > > Â Â Â Âreturn cpumask_of_node(dev_to_node(dev));
> > > }
> > >
> > > ? This would work fine in all cases.
>
> Yes, I think so. That's the general solution w/o additional
> "ifdefing".
>
> > you are right, dev_to_node(dev) could return -1 on 64bit, if there
> > is no memory on that node.
>
> Hmm, I thought just in the CONFIG_NUMA=n case -1 is returned.
>
> During initialization the struct device's numa_node is set to -1 and
> later on the information is inherited from the parent numa_node.
>
> So what do I miss?

I like the idea of cpumask_of_pcidev(), but it seems like
cpumask_of_pcibus should return the same value. So if the node is
unassigned or "equadistant" (there's code that treats -1 as both I
think), cpumask_of_pcibus should figure out what the nearest CPUs are
and return that, right?

--
Jesse Barnes, Intel Open Source Technology Center
--
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/