Re: [PATCH 2/2] mm/memory-failure: improve large block size folio handling.
From: Miaohe Lin
Date: Sat Oct 11 2025 - 05:08:19 EST
On 2025/10/11 13:00, Matthew Wilcox wrote:
> On Sat, Oct 11, 2025 at 12:12:12PM +0800, Miaohe Lin wrote:
>>> folio_set_has_hwpoisoned(folio);
>>> - if (try_to_split_thp_page(p, false) < 0) {
>>> + /*
>>> + * If the folio cannot be split to order-0, kill the process,
>>> + * but split the folio anyway to minimize the amount of unusable
>>> + * pages.
>>> + */
>>> + if (try_to_split_thp_page(p, new_order, false) || new_order) {
>>> + /* get folio again in case the original one is split */
>>> + folio = page_folio(p);
>>
>> If original folio A is split and the after-split new folio is B (A != B), will the
>> refcnt of folio A held above be missing? I.e. get_hwpoison_page() held the extra refcnt
>> of folio A, but we put the refcnt of folio B below. Is this a problem or am I miss
>> something?
>
> That's how split works.
I read the code and see how split works. Thanks for point this out.
>
> Zi Yan, the kernel-doc for folio_split() could use some attention.
That would be really helpful.
Thanks.
.
> First, it's not kernel-doc; the comment opens with /* instead of /**.
> Second, it says:
>
> * After split, folio is left locked for caller.
>
> which isn't actually true, right? The folio which contains
> @split_at will be locked. Also, it will contain the additional
> reference which was taken on @folio by the caller.
>
> .
>