Received: by 10.213.65.68 with SMTP id h4csp917407imn; Tue, 27 Mar 2018 11:09:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4//uoGNYoaWan2o9eoeLD0/cCpXJC8HOpihGTFcgU9MxsPLIBUhXLLS/hWvMbpzhbDB/zru X-Received: by 2002:a17:902:8483:: with SMTP id c3-v6mr345273plo.156.1522174180128; Tue, 27 Mar 2018 11:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522174180; cv=none; d=google.com; s=arc-20160816; b=OtRlWUSs/9VyaoV9ukAkJTcdrpvKoVfDTfipYP+zE7IncutOqa6ON4GP5jjoUtzXet 0TgcFE6mjZO78WBX54+XG3pUfrvaSuGdQPu20jtFdCJO5SxFRGJnKsDVI1vIeZMd5hMd qSkFvOPb+bI2m1ueweaBdRuTMBrW3CEc9BqswM9+6Zp1AxJpxDDrr5IKm0wtdejEnKXj 9ykpqwyWpHG0ujo+resF3/QOIDE2YlGbi8AvW+NsQajnWP88wwg4mQWm3Pd9Dit/8xnv iEmdzmT+nFmcE67IOYbtiLVwBzIwPAqZqyjaLDvc7JU+CkNqW2hAUVdo5R00dAGdaT// pLwQ== 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=OvWmLAc+4ecyE8ReuK/5uO/QOeY/+IvBuI7eVdkjBLM=; b=zjr6kzmcsXkabyex5RRpc6FN9cR1SKesEnQt0YuwmRYggKyQuzXBp3Sqj+hx2Fl67h dFgsDrTAb1cIV4ixvhcLgWMJKvwvlcQhx/Oq265z+2/dw73U25BT3No7JHQEpelG3wSg 8M4ft4mnyod9ldgoYJ4B9pO6houBq4beXXEZmjr/1YUBhSO4AZcOKd8AYpn0r5VDgX67 W1I8Ikja7WXAgFm580MpIQLA5XIMID0Tg8efhRtq8PMqZKxJZHgu4AAuMy0nNAiSVzLj 3hBbQBNg7yc25kteq9ayQopUZNwiwAWAIvf5yqXt7Joq04w9ZlXKcHbz3EYWzuCgarNV K8IQ== 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 e6si1096590pgt.442.2018.03.27.11.09.25; Tue, 27 Mar 2018 11:09:40 -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 S1752675AbeC0SIW (ORCPT + 99 others); Tue, 27 Mar 2018 14:08:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41302 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752600AbeC0Q3W (ORCPT ); Tue, 27 Mar 2018 12:29:22 -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 EDD5810D3; Tue, 27 Mar 2018 16:29:21 +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.4 25/43] acpi, numa: fix pxm to online numa node associations Date: Tue, 27 Mar 2018 18:27:29 +0200 Message-Id: <20180327162717.824794350@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@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.4-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);