From patchwork Mon Nov 29 13:38:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yaozhenguo X-Patchwork-Id: 12644535 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 D2D49C433EF for ; Mon, 29 Nov 2021 13:38:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36F2C6B0071; Mon, 29 Nov 2021 08:38:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31F0E6B0072; Mon, 29 Nov 2021 08:38:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E5F36B0073; Mon, 29 Nov 2021 08:38:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 0B6D96B0071 for ; Mon, 29 Nov 2021 08:38:26 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C08BB181A870F for ; Mon, 29 Nov 2021 13:38:15 +0000 (UTC) X-FDA: 78862071750.15.01974F7 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf12.hostedemail.com (Postfix) with ESMTP id 7510710003C6 for ; Mon, 29 Nov 2021 13:38:15 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id u17so12192529plg.9 for ; Mon, 29 Nov 2021 05:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Om9Vpj2eEDIjSh+H6i8e/yMs6hn/L468LtrHAmEffB0=; b=jDZCMFKxnuuk3GbLiU/mafDUmAiCkJu3nLr240MUixztB5sOK3xLLox60J98qEl08p LPIfBMedoK1zZQfOyEcdBYs3aY/wNZzbmsqju8NdeulC7Fjp6Av2Y0fPttqjIwcZ+hEy x717Nx4/NiMjYxOjTo8YMz0qe38KT4rQZgT0osaa3R8d1Zf3vRw9NVDkB4qG5cV7ubRl 4U6gLodXrtGpUijGKcKTSqFwl8aJbSmVLlH4JJ2luQMO4h0YOEoKqNQQNuKKp0K9G6Eo jMEkwzBjPzYsdzPfzEwKnxRoISVga9aLWe1Cmeuuu437ipDogqxiQZ6UavDOmZZ51g4V VUsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Om9Vpj2eEDIjSh+H6i8e/yMs6hn/L468LtrHAmEffB0=; b=wk0m7ML1hQBKbCVqzBHnzc1z5Kp0ZecMD85eFEgfcyrgfXtx7lyiWTipiFm2b2Qxuu ja9F2iwuNvxdm2MLs66hbde5cM8O8n9vfMGChKmHhAY44mej8spOasnltYkoE6eTmwWl YXGgqUa40sz7jkE2Xrb20/ljmBr3Th0zPSzMcenl5vUtHO+w8yLb/49DWTEe05xh3enE RMYmYOGSw8TdJc8Vhjgi1F+10Q9ZJ0OVZYh4N+Au2TwZkOTCMuIDNMJJKDo9tbeAl0cT FoSfvP44v2B9snYV3Cx9KA8EGx3+hPnAzalh3CuCpJ/hZM2b53Fduv50vkgctrDaJX5R 9mTw== X-Gm-Message-State: AOAM5339mTUSADaJlsD+/TUwHuNKWxsUPKiijMhP+CvfOchjM4Fi1Tht IyHFMR3L/06niVK4poSUY3Q= X-Google-Smtp-Source: ABdhPJz8ZKps2ykdBomBRYp2Z+j7tQvVNxekRN/0reBY0mYFPV+t/vkFAvNVUki3x1Ib5yGHyhKB3w== X-Received: by 2002:a17:902:ced0:b0:142:189a:4284 with SMTP id d16-20020a170902ced000b00142189a4284mr61088465plg.79.1638193094398; Mon, 29 Nov 2021 05:38:14 -0800 (PST) Received: from localhost.localdomain (5e.8a.38a9.ip4.static.sl-reverse.com. [169.56.138.94]) by smtp.gmail.com with ESMTPSA id co4sm18913249pjb.2.2021.11.29.05.38.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Nov 2021 05:38:14 -0800 (PST) From: Zhenguo Yao To: mike.kravetz@oracle.com, akpm@linux-foundation.org, mlevitsk@redhat.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Zhenguo Yao Subject: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Date: Mon, 29 Nov 2021 21:38:03 +0800 Message-Id: <20211129133803.15653-1-yaozhenguo1@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7510710003C6 X-Stat-Signature: mn4fyyj8jkxc4rjax3t377yqxhgtnmmt Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jDZCMFKx; spf=pass (imf12.hostedemail.com: domain of yaozhenguo1@gmail.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=yaozhenguo1@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638193095-331831 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Signed-off-by: Zhenguo Yao Reviewed-by: Mike Kravetz Reviewed-by: Baolin Wang Reviewed-by: Muchun Song Tested-by: Maxim Levitsky --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 60f9b6a9582e..6d1603387914 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2876,7 +2876,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 >= nr_online_nodes) + if (nid != NUMA_NO_NODE && nid >= nr_online_nodes) return 0; /* do node specific alloc */ if (nid != NUMA_NO_NODE) {