From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55E52C43141 for ; Sun, 17 Nov 2019 18:00:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1E7202075C for ; Sun, 17 Nov 2019 18:00:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E7202075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C9C926B000C; Sun, 17 Nov 2019 13:00:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4C316B000D; Sun, 17 Nov 2019 13:00:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B62826B000E; Sun, 17 Nov 2019 13:00:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 9D18E6B000C for ; Sun, 17 Nov 2019 13:00:15 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 55A9A52D3 for ; Sun, 17 Nov 2019 18:00:15 +0000 (UTC) X-FDA: 76166533590.25.blood01_5974ed6ef5c11 X-HE-Tag: blood01_5974ed6ef5c11 X-Filterd-Recvd-Size: 2386 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Sun, 17 Nov 2019 18:00:14 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Nov 2019 10:00:13 -0800 X-IronPort-AV: E=Sophos;i="5.68,317,1569308400"; d="scan'208";a="215138296" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Nov 2019 10:00:13 -0800 Subject: [PATCH v2 15/18] mm/numa: Skip NUMA_NO_NODE and online nodes in numa_map_to_online_node() From: Dan Williams To: linux-nvdimm@lists.01.org Cc: "Aneesh Kumar K.V" , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, hch@lst.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-acpi@vger.kernel.org Date: Sun, 17 Nov 2019 09:45:57 -0800 Message-ID: <157401275716.43284.13185549705765009174.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <157401267421.43284.2135775608523385279.stgit@dwillia2-desk3.amr.corp.intel.com> References: <157401267421.43284.2135775608523385279.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update numa_map_to_online_node() to stop falling back to numa node 0 when the input is NUMA_NO_NODE. Also, skip the lookup if @node is online. This makes the routine compatible with other arch node mapping routines. Reported-by: Aneesh Kumar K.V Signed-off-by: Dan Williams --- mm/mempolicy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index e2d8dd21ce9d..d618121bcc17 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -137,8 +137,8 @@ int numa_map_to_online_node(int node) { int min_node; - if (node == NUMA_NO_NODE) - node = 0; + if (node == NUMA_NO_NODE || node_online(node)) + return node; min_node = node; if (!node_online(node)) {