All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH] hugetlb: Convert alloc_buddy_hugetlb_folio to use a folio
Date: Thu, 4 Apr 2024 13:13:08 +0200	[thread overview]
Message-ID: <Zg6LRGsMDOooSPpB@localhost.localdomain> (raw)
In-Reply-To: <Zg3Hecl4ejp2ctMG@casper.infradead.org>

On Wed, Apr 03, 2024 at 10:17:45PM +0100, Matthew Wilcox wrote:
> I think hugetlb is being unnecessarily paranoid here, tbh.  Or maybe
> this part is just badly structured; if we're allocating a hugetlb folio,
> it should be fine for its refcount to be temporarily elevated by someone
> else.  Not sure I can figure out what's going on in
> alloc_and_dissolve_hugetlb_folio() though.
 
AFAICR, the problem comes when we need to remap the pages for vmemmap
optimization [1].
So, IIUC:

1) if someone comes around and grabs a refcount (say something doing
   speculative stuff)
2) we do the remapping
3) that someone who took the refcount, now does a put_page()
4) vmemmap no longer points to the old page but the new one, meaning
   that that 'put_page()' is done on the wrong page.

@Munchun: Did I get this right?

[1] https://lore.kernel.org/linux-mm/YupRjWRiz4lPo+y7@FVFYT0MHHV2J/


-- 
Oscar Salvador
SUSE Labs


  reply	other threads:[~2024-04-04 11:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 20:06 [PATCH] hugetlb: Convert alloc_buddy_hugetlb_folio to use a folio Matthew Wilcox (Oracle)
2024-04-02 21:19 ` Sidhartha Kumar
2024-04-03  4:55 ` Oscar Salvador
2024-04-03  6:19   ` Muchun Song
2024-04-03  7:25     ` Oscar Salvador
2024-04-03 21:17       ` Matthew Wilcox
2024-04-04 11:13         ` Oscar Salvador [this message]
2024-04-07  7:14           ` Muchun Song
2024-04-03  6:00 ` Muchun Song

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=Zg6LRGsMDOooSPpB@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=willy@infradead.org \
    /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.