linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, muchun.song@linux.dev,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH] mm/compaction: Fix bug in hugetlb handling pathway
Date: Tue, 1 Apr 2025 16:59:46 +0200	[thread overview]
Message-ID: <Z-v_YnBV_XJ89NnO@localhost.localdomain> (raw)
In-Reply-To: <20250401021025.637333-1-vishal.moola@gmail.com>

On Mon, Mar 31, 2025 at 07:10:24PM -0700, Vishal Moola (Oracle) wrote:
> The compaction code doesn't take references on pages until we're certain
> we should attempt to handle it.
> 
> In the hugetlb case, isolate_or_dissolve_huge_page() may return -EBUSY
> without taking a reference to the folio associated with our pfn. If our
> folio's refcount drops to 0, compound_nr() becomes unpredictable, making
> low_pfn and nr_scanned unreliable.
> The user-visible effect is minimal - this should rarely happen (if ever).

So, with compound_order() we either return the real order of the
compound page or '0', right?

> Fix this by storing the folio statistics earlier on the stack (just like
> the THP and Buddy cases).
> 
> Also revert commit 66fe1cf7f581 ("mm: compaction: use helper compound_nr
> in isolate_migratepages_block")
> to make backporting easier.
> 
> Fixes: 369fa227c219 ("mm: make alloc_contig_range handle free hugetlb pages")
> Cc: Miaohe Lin <linmiaohe@huawei.com>
> Cc: Oscar Salvador <osalvador@suse.de>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>

Acked-by: Oscar Salvador <osalvador@suse.de>


-- 
Oscar Salvador
SUSE Labs


  parent reply	other threads:[~2025-04-01 14:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  2:10 Vishal Moola (Oracle)
2025-04-01  2:10 ` [PATCH] mm/compaction: Use folio in hugetlb pathway Vishal Moola (Oracle)
2025-04-01 15:04   ` Oscar Salvador
2025-04-01 15:23   ` Zi Yan
2025-04-01 14:59 ` Oscar Salvador [this message]
2025-04-01 17:55   ` [PATCH] mm/compaction: Fix bug in hugetlb handling pathway Vishal Moola (Oracle)
2025-04-01 15:20 ` Zi Yan
2025-04-01 18:09   ` Vishal Moola (Oracle)

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=Z-v_YnBV_XJ89NnO@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=vishal.moola@gmail.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