Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re:Re: [PATCH] mm/memory-failure: fix refcount leak on soft-offline LBS folio
@ 2026-08-04  3:53 李佑鸿  
  0 siblings, 0 replies; only message in thread
From: 李佑鸿   @ 2026-08-04  3:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linmiaohe, nao.horiguchi, linux-mm, liyouhong











Hi Andrew, 
Thanks for your review.






At 2026-08-04 06:06:46, "Andrew Morton" <akpm@linux-foundation.org> wrote:
>On Mon,  3 Aug 2026 14:00:01 +0800 dayou5941@163.com wrote:
>
>> From: liyouhong <liyouhong@kylinos.cn>
>> 
>> soft_offline_in_use_page() runs with a folio reference taken by
>> get_hwpoison_page() (or by the caller when MF_COUNT_INCREASED is set,
>> e.g. madvise(MADV_SOFT_OFFLINE)).
>> 
>> made soft-offline skip splitting when min_order_for_split()
>
>Something went wrong with this paragraph?
>
>> is non-zero, so large-block-size folios stay intact.  That early
>> return -EBUSY path never drops the reference.
>
>So the effect is to leak a folio ref if min_order_for_split() returns
>0.  Has this been known to happen in the real world?

>


The leak is identified via code inspection. We haven't reproduced it
under real workloads yet, but the code path clearly misses folio_put()
on this early return path and creates a reference leak risk.


>It would be good to update soft_offline_in_use_page()'s introductory
>comment to describe its folio refcount handling.

>


Will add detailed refcount handling comments in v2.
>
>Thanks, lgtm.
>
>AI review might have found a couple of pre-existing issues in the
>surrounding code.  From a quick read, it doesn't seem appropriate to
>address either within the context of this change.
>

>	https://sashiko.dev/#/patchset/20260803060001.800638-1-dayou5941@163.com


I agree. Those separate pre-existing problems are not touched here.
I will send an independent patch later to fix the TOCTOU race of folio->mapping in min_order_for_split().

I will send out v2 soon.

Thanks,
liyouhong 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-04  3:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04  3:53 Re:Re: [PATCH] mm/memory-failure: fix refcount leak on soft-offline LBS folio 李佑鸿  

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox