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 26DC5C433F5 for ; Mon, 29 Nov 2021 08:18:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 487C66B0073; Mon, 29 Nov 2021 03:18:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4379B6B0074; Mon, 29 Nov 2021 03:18:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 327316B0075; Mon, 29 Nov 2021 03:18:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 23E206B0073 for ; Mon, 29 Nov 2021 03:18:21 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CE4908DA41 for ; Mon, 29 Nov 2021 08:18:10 +0000 (UTC) X-FDA: 78861265140.04.64A0B4B Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf21.hostedemail.com (Postfix) with ESMTP id 7A498D0369CF for ; Mon, 29 Nov 2021 08:18:07 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id v138so39893458ybb.8 for ; Mon, 29 Nov 2021 00:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LrGZYEwY75NOA8kLQXYDveo+smG1qDqvJX56rg4HJ7w=; b=fjDnlTXvTE+6fKJ7pyvLjC8CkLbOdrD1B1udsBfn1lv/WzsRH07uQp2ZkQwBSIlkla fUh53XNCfMbGFWmO9vNCPFZFzu/3+bILZikJ27QlAXCMzFYKRqPWAM7PizSp+LB9heMp Bm5f2VST1/eQdDNdkZgKcHQlhPZ1Ku3CwzwRKwd5GEkq8jwLam8SJE5ea6hn4LXwVcg5 juHGLQkzfOepV2x3ZykPqezE6o5lSKUfLZjCvUuQkfBoYiNOeYGsS2k7AHiLAkDa6O5W tdtoqwOhAc2GTGeLrJlm/oobdmjh8+FhfdjHr9ThRSA13fuujaqKwp4upNwLqvZpxoPc 3pjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LrGZYEwY75NOA8kLQXYDveo+smG1qDqvJX56rg4HJ7w=; b=1hP/p1UUaj9p7ggBGjSgd4++q/7rbXwashXUJ8PUNMTqNuiSLvGlaizLE1vh9EzaVu oYCZ3fX9HQzIb+A33nT+USsKOUnlMGHeKexNtyr/gyHRKJ8R5rcdNTzYc9Qss1XO0KCa WYkOHBdf1CmU6tKyGl2t+1gJoyYsWhvooXxoyKCv9RY3Fx4Wn42/Dditf3FY9AWtDl+x /SNHg2/Nwc0I7PHdFq+ipk6dGqHuvNGBHwfvlZuplPZNB5BdkGTOhVXc3MxFmJlhTW4N M5AXEoxhM6y61Igyo91p78P8aMKcg8G/pB/VpEdT6rstSnlZTB6BVnz7LyWvfrm/W5Tv ShSg== X-Gm-Message-State: AOAM530xQxiEllrUpSJ7ExuTvql48+G9V4IY6vlj8GZwGJ6RoPijXVM/ L0UlSmtNuUsTW+g27YJdFLHZphc2TeoE+GGt46M= X-Google-Smtp-Source: ABdhPJzn789KF+5ksWANaMYpXZm0jA8vt+r1K+bpyNvLeQUtrWy7jCeYBDGG2ASgVjHxM3DXEhR61f8mZExExrbuuGQ= X-Received: by 2002:a25:2446:: with SMTP id k67mr5816069ybk.556.1638173889741; Mon, 29 Nov 2021 00:18:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Zhenguo Yao Date: Mon, 29 Nov 2021 16:17:58 +0800 Message-ID: Subject: Re: Commit 'hugetlbfs: extend the definition of hugepages parameter to support node allocation' breaks old numa less syntax of reserving hugepages on boot. To: Mike Kravetz Cc: Maxim Levitsky , Andrew Morton , Linux Memory Management List , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7A498D0369CF X-Stat-Signature: kk9ap1ac8oydgerj4kwwn7tzwuuh9wdj Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fjDnlTXv; spf=pass (imf21.hostedemail.com: domain of yaozhenguo1@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=yaozhenguo1@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638173887-56031 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: Mike Kravetz =E4=BA=8E2021=E5=B9=B411=E6=9C=8829= =E6=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=8812:31=E5=86=99=E9=81=93=EF=BC= =9A > > On 11/28/21 03:18, Maxim Levitsky wrote: > > > > dmesg prints this: > > > > HugeTLB: allocating 64 of page size 1.00 GiB failed. Only allocated 0 = hugepages > > > > Huge pages were allocated on kernel command line (1/2 of 128GB system): > > > > 'default_hugepagesz=3D1G hugepagesz=3D1G hugepages=3D64' > > > > This is 3970X and no real support/need for NUMA, thus only fake NUMA no= de 0 is present. > > > > Reverting the commit helps. > > > > New syntax also works ( hugepages=3D0:64 ) > > > > I can test any patches for this bug. > > Argh! I think preallocation of gigantic pages on all systems with only > a single node is broken. The issue is at the beginning of > __alloc_bootmem_huge_page: > > int __alloc_bootmem_huge_page(struct hstate *h, int nid) > { > struct huge_bootmem_page *m =3D NULL; /* initialize for clang */ > int nr_nodes, node; > > if (nid >=3D nr_online_nodes) > return 0; > > Without using the node specific syntax, nid =3D=3D NUMA_NO_NODE =3D=3D -1= . For the > comparison, nid will be converted to an unsigned into to match nr_online_= nodes > so we will immediately return 0 instead of doing the allocations. > > Zhenguo Yao, > Can you verify and perhaps put together a patch?does > > > > > Also unrelated, is there any progress on allocating 1GB pages on demand= so that I could > > allocate them only when I run a VM? > > That should be possible. Such support was added back in 2014 with commit > 944d9fec8d7a "hugetlb: add support for gigantic page allocation at runtim= e". > Yes, I will test it and provide a patch to fix this issue. > > > > i don't mind having these pages to be marked as to be used for userspac= e only, > > since as far as I remember its the kernel usage that makes some page un= moveable. > > > > Of course, finding 1GB of contiguous space for a gigantic page is often > difficult at runtime. So, allocations are likely to fail the longer the > system is up and running and fragmentation increases. > > > Last time (many years ago) I tried to create a zone with only userspace= pages > > (I don't remember what options I used) but it didn't work. > > Not too long ago, support was added to use CMA for gigantic page allocati= on. > See commit cf11e85fc08c "mm: hugetlb: optionally allocate gigantic hugepa= ges > using cma". This sounds like something you might want to try. > -- > Mike Kravetz > > > > > Is there a way to debug what is causing unmoveable pages and doesn't le= t > > /proc/sys/vm/nr_hugepages work (I tried it today and as usual the numbe= r > > it can allocate steadly decreases over time). > > > >