Re: [PATCH v2 1/5] mm/memory-failure: keep the folio, not the poisoned subpage, locked across split

From: Kiryl Shutsemau

Date: Tue Jul 14 2026 - 09:18:50 EST


On Tue, Jul 14, 2026 at 01:23:40PM +0100, Kiryl Shutsemau wrote:
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 51508a55c405..68d42cbed458 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1657,11 +1657,18 @@ static int identify_page_state(unsigned long pfn, struct page *p,
> static int try_to_split_thp_page(struct page *page, unsigned int new_order,
> bool release)
> {
> + struct folio *folio = page_folio(page);
> int ret;
>
> - lock_page(page);
> - ret = split_huge_page_to_order(page, new_order);
> - unlock_page(page);
> + /*
> + * Lock and split at the head, not the poisoned subpage: __folio_split()
> + * keeps the anchor folio locked and needs it to stay in the page cache
> + * to pin the inode. A tail beyond EOF would be dropped yet returned
> + * locked, losing that pin. The caller re-locks @page afterwards.
> + */
> + folio_lock(folio);
> + ret = split_folio_to_order(folio, new_order);
> + folio_unlock(folio);
>
> if (ret && release)
> put_page(page);

Ughh.. This patch is broken, sorry.

Please ignore the patchset. Will follow up.

--
Kiryl Shutsemau / Kirill A. Shutemov