From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot0-x242.google.com (mail-ot0-x242.google.com [IPv6:2607:f8b0:4003:c0f::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2E2E622135D2D for ; Sun, 18 Mar 2018 14:48:43 -0700 (PDT) Received: by mail-ot0-x242.google.com with SMTP id 79-v6so15421047oth.11 for ; Sun, 18 Mar 2018 14:55:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <152116964416.8343.514895686858363582.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152116964416.8343.514895686858363582.stgit@dwillia2-desk3.amr.corp.intel.com> From: "Rafael J. Wysocki" Date: Sun, 18 Mar 2018 22:55:10 +0100 Message-ID: Subject: Re: [PATCH] acpi, numa: fix pxm to online numa node associations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Toshi Kani , "linux-nvdimm@lists.01.org" , "Rafael J. Wysocki" , Linux Kernel Mailing List , Stable , ACPI Devel Maling List List-ID: On Fri, Mar 16, 2018 at 4:08 AM, Dan Williams wrote: > Commit 99759869faf1 "acpi: Add acpi_map_pxm_to_online_node()" added > support for mapping a given proximity to its nearest, by SLIT distance, > online node. However, it sometimes returns unexpected results due to the > fact that it switches from comparing the PXM node to the last node that > was closer than the current max. > > for_each_online_node(n) { > dist = node_distance(node, n); > if (dist < min_dist) { > min_dist = dist; > node = n; <---- from this point we're using the > wrong node for node_distance() > > > Fixes: 99759869faf1 ("acpi: Add acpi_map_pxm_to_online_node()") > Cc: > Cc: Toshi Kani > Cc: Rafael J. Wysocki > > Signed-off-by: Dan Williams > --- > Rafael, I can take this through the nvdimm tree with your ack. I have a > few other nvdimm fixes pending for 4.16. OK Acked-by: Rafael J. Wysocki > > drivers/acpi/numa.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c > index 8ccaae3550d2..85167603b9c9 100644 > --- a/drivers/acpi/numa.c > +++ b/drivers/acpi/numa.c > @@ -103,25 +103,27 @@ int acpi_map_pxm_to_node(int pxm) > */ > int acpi_map_pxm_to_online_node(int pxm) > { > - int node, n, dist, min_dist; > + int node, min_node; > > node = acpi_map_pxm_to_node(pxm); > > if (node == NUMA_NO_NODE) > node = 0; > > + min_node = node; > if (!node_online(node)) { > - min_dist = INT_MAX; > + int min_dist = INT_MAX, dist, n; > + > for_each_online_node(n) { > dist = node_distance(node, n); > if (dist < min_dist) { > min_dist = dist; > - node = n; > + min_node = n; > } > } > } > > - return node; > + return min_node; > } > EXPORT_SYMBOL(acpi_map_pxm_to_online_node); > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm