lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4xWOhG5dfVZ2XmmVcXDPicRKiBB__=3W6Z9umXjn4M-Ww@mail.gmail.com>
Date: Thu, 30 Oct 2025 12:00:27 +0800
From: Barry Song <baohua@...nel.org>
To: Zi Yan <ziy@...dia.com>
Cc: linmiaohe@...wei.com, david@...hat.com, jane.chu@...cle.com, 
	kernel@...kajraghav.com, akpm@...ux-foundation.org, mcgrof@...nel.org, 
	nao.horiguchi@...il.com, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, 
	Baolin Wang <baolin.wang@...ux.alibaba.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>, 
	Nico Pache <npache@...hat.com>, Ryan Roberts <ryan.roberts@....com>, Dev Jain <dev.jain@....com>, 
	Lance Yang <lance.yang@...ux.dev>, "Matthew Wilcox (Oracle)" <willy@...radead.org>, 
	Wei Yang <richard.weiyang@...il.com>, Yang Shi <shy828301@...il.com>, 
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-mm@...ck.org
Subject: Re: [PATCH v4 2/3] mm/memory-failure: improve large block size folio handling.

On Thu, Oct 30, 2025 at 9:40 AM Zi Yan <ziy@...dia.com> wrote:
>
> Large block size (LBS) folios cannot be split to order-0 folios but
> min_order_for_folio(). Current split fails directly, but that is not
> optimal. Split the folio to min_order_for_folio(), so that, after split,
> only the folio containing the poisoned page becomes unusable instead.
>
> For soft offline, do not split the large folio if its min_order_for_folio()
> is not 0. Since the folio is still accessible from userspace and premature
> split might lead to potential performance loss.
>
> Suggested-by: Jane Chu <jane.chu@...cle.com>
> Signed-off-by: Zi Yan <ziy@...dia.com>
> Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>

Reviewed-by: Barry Song <baohua@...nel.org>

> ---
>  mm/memory-failure.c | 31 +++++++++++++++++++++++++++----
>  1 file changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index f698df156bf8..acc35c881547 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
...
> @@ -2294,7 +2298,16 @@ int memory_failure(unsigned long pfn, int flags)
>                  * page is a valid handlable page.
>                  */
>                 folio_set_has_hwpoisoned(folio);
> -               if (try_to_split_thp_page(p, false) < 0) {
> +               err = try_to_split_thp_page(p, new_order, /* release= */ false);
> +               /*
> +                * If splitting a folio to order-0 fails, kill the process.
> +                * Split the folio regardless to minimize unusable pages.
> +                * Because the memory failure code cannot handle large
> +                * folios, this split is always treated as if it failed.
> +                */
> +               if (err || new_order) {
> +                       /* get folio again in case the original one is split */
> +                       folio = page_folio(p);

It’s a bit hard to follow that we implicitly use p to get its original
folio for splitting in try_to_split_thp_page(), and then again use p to
get its new folio for kill_procs_now(). It might be more readable to move
try_to_split_thp_page() into a helper like try_to_split_folio(folio, …),
so it’s explicit that we’re splitting a folio rather than a page?

Thanks
Barry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ