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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8663C433EF for ; Fri, 15 Apr 2022 02:09:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 437176B0071; Thu, 14 Apr 2022 22:09:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E6056B0073; Thu, 14 Apr 2022 22:09:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 286F56B0074; Thu, 14 Apr 2022 22:09:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 19FAA6B0071 for ; Thu, 14 Apr 2022 22:09:35 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D19D321396 for ; Fri, 15 Apr 2022 02:09:34 +0000 (UTC) X-FDA: 79357481868.18.B0BFCB2 Received: from antelope.elm.relay.mailchannels.net (antelope.elm.relay.mailchannels.net [23.83.212.4]) by imf18.hostedemail.com (Postfix) with ESMTP id 0A3CF1C0002 for ; Fri, 15 Apr 2022 02:09:33 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|dave@stgolabs.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B95EA560CD5; Fri, 15 Apr 2022 02:09:32 +0000 (UTC) Received: from pdx1-sub0-mail-a254.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2B575560FEB; Fri, 15 Apr 2022 02:09:32 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1649988572; a=rsa-sha256; cv=none; b=ej0QQefeNcxxoi7XPekYKjR12ktfDgwIe6oGfvsXK6SBF9a7v4U4ozSYcTv1N0K/67Jjol Hrg3gdP980QNj47N4RnJDQKDLQmJjfoqAwXSskvyDdsvt2SfcXWTJc6VPy23+BN0ihv1by MOcneCLnitVkS7CJfqiJizOBES21ylg8xZCmyaEgiidl8ARGr1ESbSa1KWuBud/u7eP5TN 7vBbq8hmlxshxwvzhk9QzhS/U9UkhOqQ3/iCJxnhVoRR6dkeNgiEdvl6IW0fgVAnwW/ae9 /op3++UW31z9XsjuCldbGUmmLHJzBO+d44XpoS/0Y8rrqMgjR0Veb1A0MzrLHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1649988572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y/CtK1gEBEC/Kw2WPYqZH9dnFhfpNqnlY6v92/MuI4o=; b=xXg0jzihQP537jJO5GB8hiVAK2axmKC8Q88F8bW2WStimubn20rVkLZ7nWEYWiilLzfT/F ZcfsyU8zQDKaDKbMPe+qi9mNUEcTerrCzZGDbniElxgUHuz1JG3Th3G5VXuiW3ZJinl1gt hINU2r33rNkZMcGD8NBhPxz8Q28eFmyw0Jd+ziK9UOV51PSJaJyS0ClyBP4JD3vJs/0aCK EKf4+2amM8QYWd0LN8Efad9yVu3vld6m6sw2HEtqrWj8bayl0Nu0LE4n9AoZlXo4iTNxZQ HKy30vmA4VsLilKq/TA6QnLTSIBuZkl3WBr3fyj7J8RRH2v4upvAqbsj6guftg== ARC-Authentication-Results: i=1; rspamd-b69d6888c-26779; auth=pass smtp.auth=dreamhost smtp.mailfrom=dave@stgolabs.net X-Sender-Id: dreamhost|x-authsender|dave@stgolabs.net Received: from pdx1-sub0-mail-a254.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.106.158.161 (trex/6.7.1); Fri, 15 Apr 2022 02:09:32 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|dave@stgolabs.net X-MailChannels-Auth-Id: dreamhost X-Well-Made-Scare: 66490a1a1715cb50_1649988572538_3954983236 X-MC-Loop-Signature: 1649988572538:2937066910 X-MC-Ingress-Time: 1649988572538 Received: from offworld (unknown [104.36.29.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dave@stgolabs.net) by pdx1-sub0-mail-a254.dreamhost.com (Postfix) with ESMTPSA id 4KffsQ67gQz21; Thu, 14 Apr 2022 19:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stgolabs.net; s=dreamhost; t=1649988571; bh=i8OD/SgEbmNj3IrkAtgDlN9p2e7lNCpA2O2Cn1jCdQw=; h=Date:From:To:Cc:Subject:Content-Type; b=O0jSIqTKFTMJCN2KiuWEkdAiRmALylGK3IKhrkKs7fSOdnx3v2SasLIMZQjnn8xMl oHV7dtDZ6EGfWczw3KzGX/XUuGrsd/L6Yqt3Wy6XyCO3Zjp9RWnTxMQC6m+GHnvSsA u7omsklgN+8P+OTY9Y+yZK6Jc5sz4yHjP0YuS2HS23tIuYq4uE5Bn9EgpGROEqOYTb OkiQUZRhLYJJOxYJpCk58NwCdpCw1G+mxZ3WOcWcgNpoDDwO3uZhV4KOYjgV3oxq4w AKNVISOoO0ZoVBLKwkeczBTB/eEOzyImO2pUGrpCK7JdUwt5QYqE7yUNf+l0MSHdVv VPElCLxWMhxIg== Date: Thu, 14 Apr 2022 19:09:27 -0700 From: Davidlohr Bueso To: Peng Liu Cc: mike.kravetz@oracle.com, david@redhat.com, akpm@linux-foundation.org, yaozhenguo1@gmail.com, baolin.wang@linux.alibaba.com, songmuchun@bytedance.com, liuyuntao10@huawei.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/4] hugetlb: Fix wrong use of nr_online_nodes Message-ID: <20220415020927.x7ylevbd5uaevfyt@offworld> Mail-Followup-To: Peng Liu , mike.kravetz@oracle.com, david@redhat.com, akpm@linux-foundation.org, yaozhenguo1@gmail.com, baolin.wang@linux.alibaba.com, songmuchun@bytedance.com, liuyuntao10@huawei.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220413032915.251254-1-liupeng256@huawei.com> <20220413032915.251254-2-liupeng256@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20220413032915.251254-2-liupeng256@huawei.com> User-Agent: NeoMutt/20201120 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=stgolabs.net header.s=dreamhost header.b=O0jSIqTK; dmarc=none; spf=pass (imf18.hostedemail.com: domain of dave@stgolabs.net designates 23.83.212.4 as permitted sender) smtp.mailfrom=dave@stgolabs.net X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0A3CF1C0002 X-Stat-Signature: w4tuuc5kriwy6uzujagfqrfrsgposunn X-HE-Tag: 1649988573-398645 X-Bogosity: Ham, tests=bogofilter, spamicity=0.090001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 13 Apr 2022, Peng Liu wrote: >Certain systems are designed to have sparse/discontiguous nodes. In >this case, nr_online_nodes can not be used to walk through numa node. >Also, a valid node may be greater than nr_online_nodes. > >However, in hugetlb, it is assumed that nodes are contiguous. Recheck >all the places that use nr_online_nodes, and repair them one by one. > >Suggested-by: David Hildenbrand >Fixes: 4178158ef8ca ("hugetlbfs: fix issue of preallocation of gigantic pages can't work") >Fixes: b5389086ad7b ("hugetlbfs: extend the definition of hugepages parameter to support node allocation") >Fixes: e79ce9832316 ("hugetlbfs: fix a truncation issue in hugepages parameter") >Fixes: f9317f77a6e0 ("hugetlb: clean up potential spectre issue warnings") >Signed-off-by: Peng Liu >Reviewed-by: Baolin Wang >Reviewed-by: Mike Kravetz Reviewed-by: Davidlohr Bueso ... but >--- > mm/hugetlb.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > >diff --git a/mm/hugetlb.c b/mm/hugetlb.c >index b34f50156f7e..5b5a2a5a742f 100644 >--- a/mm/hugetlb.c >+++ b/mm/hugetlb.c >@@ -2979,7 +2979,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid) > struct huge_bootmem_page *m = NULL; /* initialize for clang */ > int nr_nodes, node; > >- if (nid != NUMA_NO_NODE && nid >= nr_online_nodes) >+ if (nid != NUMA_NO_NODE && !node_online(nid)) afaict null_blk could also use this, actually the whole thing wants a helper - node_valid()?