Received: by 10.213.65.68 with SMTP id h4csp857989imn; Tue, 27 Mar 2018 10:03:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+BKxphCEA1f5YJVsU2fobd1mMOUkEg7tYLOedZhXimLPiwOrezO8QOa1sshx9FgP6gq4Gx X-Received: by 10.98.19.132 with SMTP id 4mr99488pft.87.1522170215715; Tue, 27 Mar 2018 10:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522170215; cv=none; d=google.com; s=arc-20160816; b=gGo/1XPIwjMWXMDCJcK2jvd+gLqhG58sr0ETmgxWjfWITkbObpR0x0nyignsAsXXuX u+y44Kn8FC4Qyz6kxAGKzErRDV0ZgcO07FpMsLPn9K5/cAn/bYEUSz7hFIZ4w1G9KQm3 ERAojQmiz73mwxJ4gWxMCW9iqnYywwbueetE17fVvGXKZg1lizNH57VluiSg1eybgE/u RJTKkyke1dX8P5nvcGJi9l3joctaDNYtdJcHh9NCh/LVwnfjGKkTp6qGcGvuC39RGOW+ TDYB7DKqYDBNT0naq327M7V1NHMxUZ6BSLtjqYkUJ8VXwSAXfzznIS4oIUufN68G07yv SQKQ== 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=CPMBtzRX+7jq8U9ThrWW30FhDbrAG6QN71vEusk4qE4=; b=app/Ciy5eSvXpC+9LCyNXii+4yTW8ds98FgkU6weO0kFiphCwXBzhO+USJbsbf0EaE hOwmBvxie+JjimmApuNfWGhE8uGcvF13Bn1F7Po6DRe/PA0WytHAsvwRaTK2/gLajeBJ dDDx8ZUWfppTmsoQ8YpSY5hxfP12/1Ej6RaswPy/xnOldAqR8gfdOByTf3Qx+du9nmLD gRQSDDP+6FetSZjQ0hc/vSWgmGYISkzi1K9SycHCmgkLKvVgexqfXU+jUaAOcYUtwQmF b/qq7ER3Tg9dFziyssI6iBGq4FBfqvxu+QmN/06eueFMevyqp7W4nVUWVfxdW/o+B9pi dy/Q== 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 y12si1283567pfk.42.2018.03.27.10.03.05; Tue, 27 Mar 2018 10:03:35 -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 S1754313AbeC0RBh (ORCPT + 99 others); Tue, 27 Mar 2018 13:01:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48682 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932510AbeC0QlU (ORCPT ); Tue, 27 Mar 2018 12:41:20 -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 BA49E7A8; Tue, 27 Mar 2018 16:41:19 +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.15 064/105] acpi, numa: fix pxm to online numa node associations Date: Tue, 27 Mar 2018 18:27:44 +0200 Message-Id: <20180327162801.592218766@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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);