All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Oscar Salvador (SUSE)" <osalvador@kernel.org>
To: Hongfu Li <hongfu.li@linux.dev>
Cc: Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Hongfu Li <lihongfu@kylinos.cn>
Subject: Re: [PATCH] mm/hugetlb: fix NR_HUGETLB accounting for kept surplus folios
Date: Tue, 24 Nov 2026 09:42:11 +0100	[thread overview]
Message-ID: <awVN4-v3zZ5fTkI8@localhost.localdomain> (raw)
In-Reply-To: <20261124-for-gather-surplus-v1-1-231e5660f3d8@kylinos.cn>

On Tue, Nov 24, 2026 at 12:41:02PM +0800, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> Commit a11a13ebbc5d ("mm/hugetlb: account restored reservations before
> freeing folios") reworked the free path of gather_surplus_pages(): when
> the pool was resized concurrently, folios that are no longer surplus
> are kept and enqueued directly instead of being freed.
> 
> However, folios on the surplus list are accounted in NR_HUGETLB when
> allocated in alloc_surplus_hugetlb_folio(), and every other path that
> returns an already accounted folio to the free list decrements
> NR_HUGETLB first, as folios on the free list must not be counted. The
> new enqueue branch skips that decrement, so the folio remains counted
> while on the free list, leaving NR_HUGETLB permanently overcounted by
> pages_per_huge_page for each kept folio. Nothing corrects that later,
> whichever path the folio takes next.
> 
> Fix this by decrementing NR_HUGETLB before enqueueing the folio, as
> done in the other enqueue paths.
> 
> Fixes: a11a13ebbc5d ("mm/hugetlb: account restored reservations before freeing folios")
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

Acked-by: Oscar Salvador (SUSE) <osalvador@kernel.org>

 

-- 
Oscar Salvador
SUSE Labs


      parent reply	other threads:[~2026-11-24  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  4:41 [PATCH] mm/hugetlb: fix NR_HUGETLB accounting for kept surplus folios Hongfu Li
2026-11-24  5:05 ` Muchun Song
2026-11-24  5:21 ` + mm-hugetlb-fix-nr_hugetlb-accounting-for-kept-surplus-folios.patch added to mm-new branch Andrew Morton
2026-11-24  8:42 ` Oscar Salvador (SUSE) [this message]

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=awVN4-v3zZ5fTkI8@localhost.localdomain \
    --to=osalvador@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hongfu.li@linux.dev \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.