Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Morin <guillaume@morinfr.org>
To: Breno Leitao <leitao@debian.org>
Cc: Guillaume Morin <guillaume@morinfr.org>,
	osalvador@suse.de, avid@kernel.org, linux-mm@kvack.org,
	riel@surriel.com, Muchun Song <muchun.song@linux.dev>
Subject: Re: [BUG] mm/hugetlb: possible temporary resv underflow
Date: Wed, 15 Jul 2026 15:58:39 +0200	[thread overview]
Message-ID: <aleSDxoADBD0Qkb-@bender.morinfr.org> (raw)
In-Reply-To: <alYZ7fso3zp3j3jv@gmail.com>

On 14 Jul  4:14, Breno Leitao wrote:
>
> On Tue, Jul 14, 2026 at 12:48:16PM +0200, Guillaume Morin wrote:
> > > > I am not sure what the best fix is but checking folio_mapcount() == 0 
> > > > in __unmap_hugepage_range() seems to do the trick
> > > > 
> > > >                 adjust_reservation = false;
> > > >  
> > > >                 spin_lock_irq(&hugetlb_lock);
> > > >                 if (!h->surplus_huge_pages && __vma_private_lock(vma) &&
> > > > -                   folio_test_anon(folio)) {
> > > > +                   folio_test_anon(folio) &&
> > > > +                   folio_mapcount(folio) == 0) {
> > > >                         folio_set_hugetlb_restore_reserve(page_folio(page));
> > > >                         /* Reservation to be adjusted after the spin lock */
> > > >                         adjust_reservation = true;
> > > 
> > > The fix looks correct to me.
> > 
> > Excellent! Will you be submitting a patch or do you need me to do
> > something there?
> 
> Up to you. You can either send it, or, I  can do it myself.

I just sent a patch, hopefully it does the job.

Did you have the chance of looking at the selftest version of the repro?
Should I spin up a patch for this as well?

Guillaume.

-- 
Guillaume Morin <guillaume@morinfr.org>


  reply	other threads:[~2026-07-15 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 15:02 [BUG] mm/hugetlb: possible temporary resv underflow Guillaume Morin
2026-07-13  9:43 ` Breno Leitao
2026-07-14 10:39   ` Guillaume Morin
2026-07-14 10:48   ` Guillaume Morin
2026-07-14 11:14     ` Breno Leitao
2026-07-15 13:58       ` Guillaume Morin [this message]
2026-07-15 16:15         ` Breno Leitao

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=aleSDxoADBD0Qkb-@bender.morinfr.org \
    --to=guillaume@morinfr.org \
    --cc=avid@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=riel@surriel.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