lkml.org 
[lkml]   [2009]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] pci: derive nearby CPUs from device's instead of bus' NUMA information
    From
    On Fri, Apr 17, 2009 at 9:21 AM, Ingo Molnar <mingo@elte.hu> wrote:
    >
    > * Andreas Herrmann <andreas.herrmann3@amd.com> wrote:
    >
    >> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
    >> index a7eb1b4..9360f3d 100644
    >> --- a/drivers/pci/pci-sysfs.c
    >> +++ b/drivers/pci/pci-sysfs.c
    >> @@ -74,7 +74,11 @@ static ssize_t local_cpus_show(struct device *dev,
    >>       const struct cpumask *mask;
    >>       int len;
    >>
    >> +#ifdef CONFIG_NUMA
    >> +     mask = cpumask_of_node(dev_to_node(dev));
    >> +#else
    >>       mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
    >> +#endif
    >>       len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
    >>       buf[len++] = '\n';
    >>       buf[len] = '\0';
    >> @@ -88,7 +92,11 @@ static ssize_t local_cpulist_show(struct device *dev,
    >>       const struct cpumask *mask;
    >>       int len;
    >>
    >> +#ifdef CONFIG_NUMA
    >> +     mask = cpumask_of_node(dev_to_node(dev));
    >> +#else
    >>       mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
    >> +#endif
    >
    > No objections against the change (at all), but this pattern cries
    > out for a different, cleaner solution.
    >
    > Shouldnt there be a cpumask_of_pcidev(dev) helper instead, which
    > [recognizing that most PCI devices dont get their node info
    > initialized in practice] would do something like:
    >
    > 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.

    you are right, dev_to_node(dev) could return -1 on 64bit, if there is
    no memory on that node.

    YH
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-04-17 21:31    [W:0.023 / U:30.196 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site