Received: by 10.213.65.68 with SMTP id h4csp69052imn; Fri, 16 Mar 2018 18:17:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELtmSYg30hRepsiyhOCpz5qeWygtSXyCxFKbQUDJkgibRhe6CQZGf2LQBhDz/hsaIFjWe6bP X-Received: by 10.101.73.141 with SMTP id r13mr3069809pgs.161.1521249468820; Fri, 16 Mar 2018 18:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521249468; cv=none; d=google.com; s=arc-20160816; b=Em9Gvgsz9R71vEYDjOxGK0jhwlqLmIrqbDDDSrC3VWd9oVlmfyEx6Rw/BBQ+PwFBtb OdMj50mqF6y+zDluKKfPuLvf1yt6XHchuefE5i82hu57SSiszu5ztWBQG04sVyoln21n RjaE6scjkpCbj8Ap+mI+MM0h3uh0D+nSn2yC4CJK5p+yhaa1x9AUJVa6hRMGRAUjz+Fe nnqFxNwuQN5VjSMNomKZHpUT1MMThua9c5y9mc93iLLSn8v6vCl2VAIk8iPYRxlVF2mr p19/zDvfjmaZ2EeYsp7oWSOkeUg1eMahXat2EF2eUTBLsz7uAuCzVIWovPIDGwZeEo9m nGgg== 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=eivOtxyGfItuGmu/odzvOd8rujIuqI3AlrDfL+OG2Ts=; b=Ya7WQGNkt/vnOWQ1VTvaCr/9gAFD9lvkCDCtvSwgzALyV/SahmbU+2aI+NRithQb8s E4+5fm5yMSMUVXbZ7+HDqngzfw1Z0ql+qqHhL2yhqUXXrv84122JsXeR3WGcWEVDtECu nbMxEckgYZDpWmySWEE/LJ6cE0Km1zKMXZRnLmSq7EYNANja47lLeRGdTSyB6dfBoo1j 74iGEiO6Qb9GlRnxVfz5dFrmzZApHxE48wAKNt/ljIPZYIKQ3HhZaKIAXdseWXzNosWc 6FyYCb7F+CyR8uCzD90uJDDxKXgod3ldsFdlvcXMFN85E7XZX3os2972lkTcf0ODxUij 7D4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dDmuhO6r; 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 y40-v6si7416743pla.367.2018.03.16.18.17.34; Fri, 16 Mar 2018 18:17:48 -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=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dDmuhO6r; 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 S1752714AbeCQBQl (ORCPT + 99 others); Fri, 16 Mar 2018 21:16:41 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:43210 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751623AbeCQBQk (ORCPT ); Fri, 16 Mar 2018 21:16:40 -0400 Received: by mail-ot0-f193.google.com with SMTP id m22-v6so12157359otf.10 for ; Fri, 16 Mar 2018 18:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eivOtxyGfItuGmu/odzvOd8rujIuqI3AlrDfL+OG2Ts=; b=dDmuhO6rwrjSuzrZscZfwfVcpX+cf94NtAvhCgI/Ovt5idib1AlvMfRZFwlOt/ye7z 5+HkTpV8Equ5GweE82WX8PHoLSs7Pcd905LI2txsbRcjPXGyAQ6kW30LHZHDeCD8m+lm geH3yvFHvwxS0LspDhhENDghd8+spD2D9IbBaLuQ2izM0necrGRNNg11HHEAUUePH/9w Hd9fmRZUlMqpNH0Yw77q3uHuElPPfZp1vGFJHcAvPu+cCQgwlxZakVPHT+6mqgZkn8WD ohDDv68Ki2GmwNcv3jq3lZWksicp7RQGurrrBvYc5D7TBGapR20AW7U0ZTY2VxQq3i32 po9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eivOtxyGfItuGmu/odzvOd8rujIuqI3AlrDfL+OG2Ts=; b=EJN94hLT499/K0rkoXpTPd5OjUD6QMcmEVu7DzwyVM928UBOtpubx+tv6Cr1Y8yBml lW4CqCZfxW686zlm4bL/kvfht2zh9y46p0i/nszKAMoVS0xHTJjT6Qz+Wjjr+Zxz7be2 d4nVX0lWtN6ucC071YJ6sbC6JS12HNuBN8owtOSg19YpQFC0luukB5Kne64tujjAce2C INIPkADm8iKK0997CHTc27YRWnwDZqQkxHXquhkkDNb1SiEeegZLhoBvykR51pddmcrY 7VmUlgx7bo7jbWP3hDTb0bT3PiWhj6ccA7krF7zt/y56zA9Qa7+KD8Ww11z1xwIaQ7eW AcXw== X-Gm-Message-State: AElRT7GL0gFhAhVs3BfMeK/lyTxPZD2DZHj60XxCo1vrpKRwN8ibo+g1 jg23p3lcUl33oDCNTFAq9FUwNtH6AqLcuOMsb0tMkw== X-Received: by 2002:a9d:26c2:: with SMTP id i2-v6mr2459369otd.292.1521249399464; Fri, 16 Mar 2018 18:16:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:5189:0:0:0:0:0 with HTTP; Fri, 16 Mar 2018 18:16:39 -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: Dan Williams Date: Fri, 16 Mar 2018 18:16:39 -0700 Message-ID: Subject: Re: [PATCH] acpi, numa: fix pxm to online numa node associations To: linux-nvdimm Cc: stable , "Rafael J. Wysocki" , Linux ACPI , Linux Kernel Mailing List , Toshi Kani 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 [ adding Toshi's correct address ] On Thu, Mar 15, 2018 at 8:08 PM, 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. > > 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); > >