[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-v_YnBV_XJ89NnO@localhost.localdomain>
Date: Tue, 1 Apr 2025 16:59:46 +0200
From: Oscar Salvador <osalvador@...e.de>
To: "Vishal Moola (Oracle)" <vishal.moola@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, muchun.song@...ux.dev,
Miaohe Lin <linmiaohe@...wei.com>
Subject: Re: [PATCH] mm/compaction: Fix bug in hugetlb handling pathway
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@...wei.com>
> Cc: Oscar Salvador <osalvador@...e.de>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
Acked-by: Oscar Salvador <osalvador@...e.de>
--
Oscar Salvador
SUSE Labs
Powered by blists - more mailing lists