All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Xueyuan Chen <xueyuan.chen21@gmail.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	zhaonanzhe@xiaomi.com, baohua@kernel.org, hannes@cmpxchg.org,
	youngjun.park@lge.com, baolin.wang@linux.alibaba.com,
	hughd@google.com, chrisl@kernel.org, kasong@tencent.com,
	shikemeng@huaweicloud.com, nphamcs@gmail.com,
	baoquan.he@linux.dev, mhocko@kernel.org,
	roman.gushchin@linux.dev, shakeel.butt@linux.dev,
	muchun.song@linux.dev, ljs@kernel.org, liam@infradead.org,
	vbabka@kernel.org, rppt@kernel.org, surenb@google.com,
	qi.zheng@linux.dev, axelrasmussen@google.com, yuanchu@google.com,
	weixugc@google.com
Subject: Re: [RFC PATCH v5 3/4] mm/vmscan: avoid pointless large folio splits without swap
Date: Thu, 6 Aug 2026 15:58:29 +0200	[thread overview]
Message-ID: <ee89226e-64b3-48e6-9be2-4934c23b729f@kernel.org> (raw)
In-Reply-To: <20260730122304.2496440-4-xueyuan.chen21@gmail.com>

On 7/30/26 14:23, Xueyuan Chen wrote:
> From: "Barry Song (Xiaomi)" <baohua@kernel.org>
> 
> When swap is disabled, exhausted, or unavailable due to memcg swap
> limits, splitting a large anonymous folio cannot make swapout progress.
> The fallback only destroys the large folio and inflates split statistics.
> 
> Use -E2BIG from folio_alloc_swap() as the explicit signal that splitting
> the folio might allow swapout of smaller pieces. For other allocation
> failures, keep the existing activation path and avoid the split.
> 
> This preserves the split fallback for fragmented or partially available
> swap, while avoiding it when there is no backing space for any part of the
> folio.
> 
> Reported-by: Nanzhe Zhao <zhaonanzhe@xiaomi.com>

Do you have a link to the report?

I assume this is not Fixes-worthy.

> Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org>
> Signed-off-by: Xueyuan Chen <xueyuan.chen21@gmail.com>
> ---
>  mm/vmscan.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 26df81e773ff..457049e130df 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1263,6 +1263,8 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>  		 */
>  		if (folio_test_anon(folio) && folio_test_swapbacked(folio) &&
>  				!folio_test_swapcache(folio)) {
> +			int ret;
> +
>  			if (!(sc->gfp_mask & __GFP_IO))
>  				goto keep_locked;
>  			if (folio_maybe_dma_pinned(folio))
> @@ -1281,11 +1283,14 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>  				    split_folio_to_list(folio, folio_list))
>  					goto activate_locked;
>  			}
> -			if (folio_alloc_swap(folio)) {
> +			ret = folio_alloc_swap(folio);
> +			if (ret) {
>  				int __maybe_unused order = folio_order(folio);
>  
>  				if (!folio_test_large(folio))
>  					goto activate_locked_split;
> +				if (ret != -E2BIG)
> +					goto activate_locked;
>  				/* Fallback to swap normal pages */
>  				if (split_folio_to_list(folio, folio_list))
>  					goto activate_locked;

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


  reply	other threads:[~2026-08-06 13:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 12:23 [RFC PATCH v5 0/4] mm: avoid large folio splits when swap is unavailable Xueyuan Chen
2026-07-30 12:23 ` [RFC PATCH v5 1/4] mm: add page_counter_margin() Xueyuan Chen
2026-08-06 13:51   ` David Hildenbrand (Arm)
2026-07-30 12:23 ` [RFC PATCH v5 2/4] mm: distinguish large folio swap allocation failures Xueyuan Chen
2026-08-06 13:56   ` David Hildenbrand (Arm)
2026-08-07  8:29   ` Kairui Song
2026-08-07 20:11     ` Yosry Ahmed
2026-08-07 21:06     ` Johannes Weiner
2026-08-07 23:10     ` Barry Song
2026-08-10  8:06     ` Xueyuan Chen
2026-08-07 23:12   ` Barry Song
2026-08-10 14:11     ` Xueyuan Chen
2026-07-30 12:23 ` [RFC PATCH v5 3/4] mm/vmscan: avoid pointless large folio splits without swap Xueyuan Chen
2026-08-06 13:58   ` David Hildenbrand (Arm) [this message]
2026-08-07 23:24     ` Barry Song
2026-08-07  2:03   ` Baolin Wang
2026-07-30 12:23 ` [RFC PATCH v5 4/4] mm/shmem: split large folios only on -E2BIG Xueyuan Chen
2026-08-06 13:59   ` David Hildenbrand (Arm)
2026-08-07 23:26   ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee89226e-64b3-48e6-9be2-4934c23b729f@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=qi.zheng@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=xueyuan.chen21@gmail.com \
    --cc=youngjun.park@lge.com \
    --cc=yuanchu@google.com \
    --cc=zhaonanzhe@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.