Received: by 10.213.65.68 with SMTP id h4csp1104169imn; Sun, 18 Mar 2018 14:58:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELuXAZ5u25mgfiJ/KveNBFttrI05E0VBCboTSpfVrEcjICN56LuNWq9D2PpH9WboRcMCcTWg X-Received: by 10.98.59.208 with SMTP id w77mr8271247pfj.59.1521410300632; Sun, 18 Mar 2018 14:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521410300; cv=none; d=google.com; s=arc-20160816; b=JvzZ4aADE7GoRaQDgRYXpHslwBzEaYDWuYOszxrj6nh0Vl12d53a1Ysn3oFaTxrquT DeHayCdZkBy5lNIViOkXqSlx767vCA3MqHYFkxIngp/lmJgv+ePyFspeBEMvfMuDZquM XGK+3E7fr7fkcouYiFG5zdOkFQJKq5qvelrdrXZQh7OKsIwTUbPq0yThSHegnPdEusCT vy1cy8iukezuolP1RzzmEZ+7pmoYtQ6Xh8lt9kHthZGRpdozdqm3OT9ru/jaQmFgkv2h /D/tybYpvpxyzbPdmx9lxuPUw7HG8mtE7ur2tlr/T2R4ehHSDqmZovSV+pi8/qUH60D/ WQpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=KYe6Thnj/chYt8paxgCAFAnTirkCoO2c20ir31cUdQ4=; b=vem9oZZHjOZSszC8MGvNiC04zeJVgyQvsZBHsK1ZjdsVx4RP1/0EP/1HQp3bn8ENeo j1N10jMNYI6yqiuBW0r9hhVJQqsLf3O6yBSnvvRu2dr+IYUbndnSvcxIVEhQVhRXofhj ynBwGXnOop6hFi3gC5qfmU2INoYDn3ce4qV+5DYQC+a9GSa8nqyZDKX5F8nSMZxL5dFD mWvTbuy/O1MUB0ikcoGwJZvM1uTwCqmH/kMlRj3Wam+6QcbeSF3Zn9qGomamA/zYhzjM hbgmaMNi+Ln/79o3Vee4AKxK23PcSMx1gVpMVW7+Tq8HdnTC374WofiGpz0ZgvPX4ecM vntA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dQoxtPMD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si9449597pfa.170.2018.03.18.14.58.06; Sun, 18 Mar 2018 14:58:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dQoxtPMD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754710AbeCRVzP (ORCPT + 99 others); Sun, 18 Mar 2018 17:55:15 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:33373 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304AbeCRVzL (ORCPT ); Sun, 18 Mar 2018 17:55:11 -0400 Received: by mail-ot0-f196.google.com with SMTP id y11-v6so15479835otg.0; Sun, 18 Mar 2018 14:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=KYe6Thnj/chYt8paxgCAFAnTirkCoO2c20ir31cUdQ4=; b=dQoxtPMDlrcjMLGzKgZLjBmJdvnsmoeVqCmTi7LO6bf7kIfI9RL6UjK7yL65WdXwyc XVHFfHK5o/saJkB8gbvRkcyTYAIrlMV/0uxm9HuqTXGuv8GqbS/WdfuzqtZ6w0xEDeeb jigeqZN0HXRWaep7+J5BPwSLMbg2udzd4f3WB6MxhG5Rf2tM+sW4jV4xlDkgB+8Mt5gp yaQd0XaQ65qHBYJHVqlIdW+5FWEHWz/HQksE1I9eTv8WvKNF04sF3p7Ecfe9lMYwXJJb 4Ivt+v5eVKPxOJczIno36fJyvHfxh4o8AcnB2QWDta3q7aw9PxYKnfzimpoaPOHwHOIa tmzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=KYe6Thnj/chYt8paxgCAFAnTirkCoO2c20ir31cUdQ4=; b=sfWH5eLeqsxfOLI5qDlM7l5I943hrJkjEw6ONXrDJWH098ytgRVF+pX3ucNxXrTj6I YS5B85N1CRrUi3SAXZcBz6eUi0UeoGTMIKqMk2EH+A3D/fsKMBMZ/g4EQroYegK2cxwG H9jZnEQRhN3nQY9NrlGLrA+Hky9lZLBA0qkQbGo9cdMCNYvegoTN6uF2z2SbAIhA/l8p 72SexejIqbyPwx6OEBfmcmEcNRkV5zQPt1Urk3C2oLmYJOhQaF5bNZwgUA2HivNzbg+n ybtkRc43lHRTQsOfnn8nzwtSAqsN5dOIxC2Zf5xg02Yqq2AaB7yFfAmXmRG6yLkIaoCu 5VOw== X-Gm-Message-State: AElRT7FcHCn+DCkrUpralZY1G1ITw82304cxwrP7H2/zqxyqihGxiWvL ZI1D8N9GyUTCBrbqP53B7QIzKS8gnG9xCWzzxSw= X-Received: by 2002:a9d:5c7:: with SMTP id 65-v6mr6073606otd.364.1521410110754; Sun, 18 Mar 2018 14:55:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:9f7:0:0:0:0:0 with HTTP; Sun, 18 Mar 2018 14:55:10 -0700 (PDT) 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 X-Google-Sender-Auth: -GUrthSlcWLq7MQu-QONYtt6XDc Message-ID: Subject: Re: [PATCH] acpi, numa: fix pxm to online numa node associations To: Dan Williams Cc: "linux-nvdimm@lists.01.org" , Stable , Toshi Kani , "Rafael J. Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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