Received: by 10.213.65.68 with SMTP id h4csp880314imn; Tue, 27 Mar 2018 10:28:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/abph7bg4pFSg7z1DHObXKDeYWtzkrCb1MgGbvXXBMb4Sq2/G8v293WrRhFxP6ZJjR+o+V X-Received: by 2002:a17:902:7d81:: with SMTP id a1-v6mr193428plm.193.1522171723027; Tue, 27 Mar 2018 10:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171722; cv=none; d=google.com; s=arc-20160816; b=bc6MG+OH4IkxE0D4FXAQzuLEt8H4g0XVFGPJTOE0xV5Hbpn/HOxWlPAH28/W1qKt0c Gaov2lFLrnF0C77xtCQ/t8D8FA1dMlqTCgwzLN0Wc/WLJSPzzzK7TqaP6FaJ53VD/G+f XRj0hUsr1PNmMWPl6tAzA3VzeDBEOUlQdZ/xmA7NsQfgKHC3X75PhSwZaUJdpxH99QeK 0uHcB+JkS2Jbov09QW51Zd+XFwwSi/Y61opgt9kJzC1LN1kPhbKIatrwpo5DRB4kVIcA qiF9pjVcjrG/WrC7dO0cpmj2OClTObuigGFdhVBZBqt00/XAcB9W/AWyKdTwpqhAiZiq STew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bKYpPzv6vHl4a5LzKJllNQ58AKGnZ4b3dt0fwjPvaWE=; b=CzfGMvW6htNj9iECxN5P/DyCike5CSREhLTvab5Swed+2/zjpN8Ir015oi6iwPwLgN 1BWL7X55gYHS3EoDhLYrgFndpn3ut86nlBFAQcqNGpJeyM5qfQGaXe9uZrB+XrfC0k/Z u8kioHRbJWhsd7mFBeZ3mnhfNGXnKv5GoJ0kFXnlKXTuzPnvWlD/ON/OaI6Vnz68r8dT oprrfCoyPVYUxqPJNS64WwUWl5BDNcjCp+kQt40mnY/tFp4MX+xn0ccosF1HTOTc1Tma 7ydMsy0J/oG6+1mYyz9jKd6GjMhDZm2mi55QNnXrU2t2XPBEAT3a6xPmkrQe3T2HR37S 8n7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 j11-v6si1576307plt.266.2018.03.27.10.28.28; Tue, 27 Mar 2018 10:28:42 -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; 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 S1754757AbeC0Qgo (ORCPT + 99 others); Tue, 27 Mar 2018 12:36:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45834 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754398AbeC0Qgl (ORCPT ); Tue, 27 Mar 2018 12:36:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8AFD2ED4; Tue, 27 Mar 2018 16:36:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Toshi Kani , Dan Williams Subject: [PATCH 4.14 059/101] acpi, numa: fix pxm to online numa node associations Date: Tue, 27 Mar 2018 18:27:31 +0200 Message-Id: <20180327162753.623173436@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Williams commit dc9e0a9347e932e3fd3cd03e7ff241022ed6ea8a upstream. 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: Reviewed-by: Toshi Kani Acked-by: Rafael J. Wysocki > Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/numa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- 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);