From patchwork Fri Dec 10 22:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12671297 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 4ABCDC433EF for ; Fri, 10 Dec 2021 22:57:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58EB16B0096; Fri, 10 Dec 2021 17:47:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 53C696B0098; Fri, 10 Dec 2021 17:47:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42C3B6B0099; Fri, 10 Dec 2021 17:47:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 350FC6B0096 for ; Fri, 10 Dec 2021 17:47:22 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F010C8248D52 for ; Fri, 10 Dec 2021 22:47:11 +0000 (UTC) X-FDA: 78903371862.15.079ADE4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf15.hostedemail.com (Postfix) with ESMTP id 6A7EFA0005 for ; Fri, 10 Dec 2021 22:47:09 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89093B82A11; Fri, 10 Dec 2021 22:47:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15827C00446; Fri, 10 Dec 2021 22:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1639176429; bh=Ipr7UkUlp1rdnsMHDy+j401Xup9F5oldxVpPXNcII90=; h=Date:From:To:Subject:In-Reply-To:From; b=lwuidf5HBCtNe2+WpBJueFCAKwf4ZaJMYISai6pIjl/DFLMwoOoKUaa5k3oLrEoKw arhA97WaI94xhSn3DOIcq6No11Vq5HheOJbC9fKRvzg6qkhuV3OOZaekzPvn3N5nED RIenXNMWUF5Aw9Cf0JcYgCSgHiNPkO7abAPrKDp4= Date: Fri, 10 Dec 2021 14:47:08 -0800 From: Andrew Morton To: akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, mike.kravetz@oracle.com, mlevitsk@redhat.com, mm-commits@vger.kernel.org, songmuchun@bytedance.com, torvalds@linux-foundation.org, yaozhenguo1@gmail.com Subject: [patch 20/21] hugetlbfs: fix issue of preallocation of gigantic pages can't work Message-ID: <20211210224708.7z79_4XIx%akpm@linux-foundation.org> In-Reply-To: <20211210144539.663efee2c80d8450e6180230@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6A7EFA0005 X-Stat-Signature: 8zkauaojbh59trjwy8qn9mz4e1f3gr3o Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=lwuidf5H; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1639176429-550586 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: From: Zhenguo Yao Subject: hugetlbfs: fix issue of preallocation of gigantic pages can't work Preallocation of gigantic pages can't work bacause of commit b5389086ad7b ("hugetlbfs: extend the definition of hugepages parameter to support node allocation"). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will always return without doing allocation. Fix this by adding more check. Link: https://lkml.kernel.org/r/20211129133803.15653-1-yaozhenguo1@gmail.com Fixes: b5389086ad7b ("hugetlbfs: extend the definition of hugepages parameter to support node allocation") Signed-off-by: Zhenguo Yao Reviewed-by: Mike Kravetz Tested-by: Maxim Levitsky Reviewed-by: Muchun Song Reviewed-by: Baolin Wang Signed-off-by: Andrew Morton --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/hugetlb.c~hugetlbfs-fix-issue-of-preallocation-of-gigantic-pages-cant-work +++ a/mm/hugetlb.c @@ -2973,7 +2973,7 @@ int __alloc_bootmem_huge_page(struct hst struct huge_bootmem_page *m = NULL; /* initialize for clang */ int nr_nodes, node; - if (nid >= nr_online_nodes) + if (nid != NUMA_NO_NODE && nid >= nr_online_nodes) return 0; /* do node specific alloc */ if (nid != NUMA_NO_NODE) {