mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Ackerley Tng <ackerleytng@google.com>,
	Zhao Li <enderaoelyther@gmail.com>,
	Jinmeng Zhou <zhoujinmeng@bytedance.com>,
	Alex Shi <alexs@kernel.org>, David Hildenbrand <david@kernel.org>,
	Dongliang Mu <dzm91@hust.edu.cn>,
	Hongxiang Lou <louhongxiang@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	"Liam R. Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Michal Hocko <mhocko@kernel.org>, Mike Rapoport <rppt@kernel.org>,
	Muchun Song <muchun.song@linux.dev>,
	Nhat Pham <nphamcs@gmail.com>, Oscar Salvador <osalvador@suse.de>,
	Peter Xu <peterx@redhat.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Usama Arif <usama.arif@linux.dev>,
	Vlastimil Babka <vbabka@kernel.org>,
	Wupeng Ma <mawupeng1@huawei.com>,
	Yanteng Si <si.yanteng@linux.dev>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	fvdl@google.com, jthoughton@google.com, rientjes@google.com,
	vannapurve@google.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v3 0/4] Fix HugeTLB subpool used_hpages tracking
Date: Thu, 24 Sep 2026 00:09:12 +0200	[thread overview]
Message-ID: <20260923220912.46905-1-kmehltretter@gmail.com> (raw)
In-Reply-To: <20260916201307.5618114cbac4af52d98aecfa@linux-foundation.org>

On Wed, 16 Sep 2026 20:13:07 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> So if downstream people (-stable maintainers, others) follow our
> recommendations, some kernels will get two of these patches, other
> kernel versions will get three and some lucky kernels might get all
> four.  Are you confident that the patches can be split apart in this
> fashion and still produce a good result?

Two things I noticed while testing this series on v7.3-rc3 (x86_64
QEMU, one CPU):

1. It overlaps with two fixes already queued in mm.git, so I've added
   their authors to Cc:

   - 3/4 rewrites the same out_subpool_put: block as Zhao Li's
     "mm/hugetlb: fix max-only subpool accounting on
     alloc_hugetlb_folio failure" (mm-hotfixes-unstable), and has the
     same Fixes: tag.
   - 2/4 rewrites the same out_put_pages: block as Jinmeng Zhou's
     "mm/hugetlb: fix subpool minimum reservation rollback"
     (mm-unstable).

   3/4 doesn't apply to mm-hotfixes-unstable, and 2/4-4/4 don't apply
   to mm-unstable. If I read them right, the queued fixes only handle
   mounts with size=, while 2/4 and 3/4 also cover min_size mounts, so
   they would probably replace them.

2. On splitting: 1/4 applies cleanly on top of both queued fixes, but
   in my tests it made min_size-only mounts worse on its own. As far
   as I can tell, that's because it starts tracking used_hpages on
   those mounts, while the two error paths only release it after 2/4
   and 3/4.

   HugePages_Rsvd, expected value in parentheses. Q = the two queued
   fixes, wrap = 18446744073709551615:

                                   rc3   +Q  +1/4  +Q+1/4  +1/4..4/4
   min_size=4M only:
     SIGBUS faults [1], no files (2)  2    2     0      0      2
   min_size=8M only:
     failed mmap [2], umounted (0)    0    0     3      3      0
   size=8M,min_size=4M:
     SIGBUS faults [1], no files (2)  0    0     0      0      2
   size=10M,min_size=8M:
     failed mmap [2], umounted (0)  wrap   0  wrap      0      0

   With 1/4 alone, the min_size-only mount loses its reservation, and
   in the failed-mmap case three huge pages stay reserved after umount,
   presumably because the subpool is never freed.

So it looks to me like 1/4 shouldn't go anywhere without 2/4 and 3/4.
I haven't tested older stable trees. With all four patches applied,
all the cases above give the expected values, and so does the
partial-truncate case from the 1/4 changelog (Rsvd drops to 0 after
the truncate instead of staying at 1).

I'm happy to rerun these tests on a rebased v4.

[1] https://lore.kernel.org/r/20260923065714.20781-1-kmehltretter@gmail.com/
[2] the scenario from Jinmeng's changelog:
    https://lore.kernel.org/20260907132055.26696-1-zhoujinmeng@bytedance.com

Thanks,
Karl

  parent reply	other threads:[~2026-09-23 22:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 23:39 Ackerley Tng via B4 Relay
2026-09-16 23:39 ` [PATCH v3 1/4] mm: hugetlb: Track used_hpages when getting/putting pages from subpool Ackerley Tng via B4 Relay
2026-09-16 23:39 ` [PATCH v3 2/4] mm: hugetlb: Fix out_put_pages subpool reserve calculation Ackerley Tng via B4 Relay
2026-09-16 23:39 ` [PATCH v3 3/4] mm: hugetlb: Fix subpool usage leak on allocation failure Ackerley Tng via B4 Relay
2026-09-16 23:39 ` [PATCH v3 4/4] mm: hugetlb: Avoid re-allocating global reservations on region add failure Ackerley Tng via B4 Relay
2026-09-17 19:26   ` Joshua Hahn
2026-09-18  3:13   ` Ackerley Tng
2026-09-17  3:13 ` [PATCH v3 0/4] Fix HugeTLB subpool used_hpages tracking Andrew Morton
2026-09-17 19:29   ` Joshua Hahn
2026-09-18  3:05   ` Ackerley Tng
2026-09-18  3:53     ` Andrew Morton
2026-09-18  3:21   ` Ackerley Tng
2026-09-23 22:09   ` Karl Mehltretter [this message]
2026-09-24  0:27     ` Ackerley Tng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923220912.46905-1-kmehltretter@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexs@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=dzm91@hust.edu.cn \
    --cc=enderaoelyther@gmail.com \
    --cc=fvdl@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=jthoughton@google.com \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=louhongxiang@huawei.com \
    --cc=mawupeng1@huawei.com \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=nao.horiguchi@gmail.com \
    --cc=nphamcs@gmail.com \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=si.yanteng@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vannapurve@google.com \
    --cc=vbabka@kernel.org \
    --cc=zhoujinmeng@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®