Received: by 10.213.65.68 with SMTP id h4csp904795imn; Tue, 27 Mar 2018 10:55:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx49GKBbsq9qo/HBxqkaT5Y3T3s5d0ShGgvlcGB2LmoCxACYf3SwgWvsqaC0LT36CFs9apFj8 X-Received: by 2002:a17:902:5501:: with SMTP id f1-v6mr315953pli.50.1522173351866; Tue, 27 Mar 2018 10:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173351; cv=none; d=google.com; s=arc-20160816; b=wF226RQsROoyNGgIqYvT5Nq0qX94lVn9p7OXS3JSzEUDfLdLnLFV1Pz9F6OEyYXtJx AYalEvTbJJhOUJugCgqxGfR7yM7E84qM5Tl02Cbd0iBrOtJSgMB5XAB6BvbugDROM6Yq pblfw1C/TjsmnA5ANq2yAet3T2LdJa7gq+PWAhPqm+M1khp3BtmW7XvzPzJ9ydsYGyFM uo/hx+/f7bXzUiHoE5N63NpSBdja9qr58W3+nJe6tU3IRmqoO6KQXFSskU5zSs+j5cev ASPMI/JeZMof8XTQLx00Y4X7YyH1BfyYvjFncV6cqWELuii0pTDUGcSkmORgsKrmMTSf z6jw== 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=SjuThd0ww9QUEYsUQQfOK1YrVAABBtTnNHuprhVQt6c=; b=nHxbSFtz/ad5WvFaqr4jRX7fcV2JnyUWgrQyU2iekghi8U8sVnHuVEj3YKvSlk/W7P pdUOCs4sEI9jCPBh9yI9/4LOq6wyHocxr9QqzyhH45Xu1anf7Gv3FVhDMsA6lwchhXaV 37xQGHhmvMfDbL2fDTCIzwt42FSPggc18BqawJtzHCk+L8H9B3KzAf7mILwD8LWZUKN6 uqLxCVf7FEy/4qdx6BTOU7iJJ+jRG7lNvYkG0ovTIRblBnJpmuK/2RT7Oht72Vy4+8+1 6CmM2p7FU8YWns4MbCjQaD52Xkh/f7I2IQBgc+OZ/pjEhLIoBnN5VSBUsZmFQ50jQJL9 V/AA== 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 j91-v6si1632718pld.14.2018.03.27.10.55.37; Tue, 27 Mar 2018 10:55:51 -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 S1753451AbeC0Qbt (ORCPT + 99 others); Tue, 27 Mar 2018 12:31:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43070 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeC0Qbr (ORCPT ); Tue, 27 Mar 2018 12:31:47 -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 79589EB5; Tue, 27 Mar 2018 16:31:46 +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.9 32/67] acpi, numa: fix pxm to online numa node associations Date: Tue, 27 Mar 2018 18:27:24 +0200 Message-Id: <20180327162728.768009842@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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);