mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Gregory Price <gourry@gourry.net>
Cc: albin_yang@163.com, liam@infradead.org, ljs@kernel.org,
	david@kernel.org, vbabka@kernel.org, jannh@google.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	albinwyang@tencent.com
Subject: Re: [PATCH] mm/madvise: add cond_resched() in THP branch of madvise_cold_or_pageout_pte_range()
Date: Sat, 10 Oct 2026 13:51:16 -0700	[thread overview]
Message-ID: <20261010135116.7d2a4f3b1a25e54fe4617fb6@linux-foundation.org> (raw)
In-Reply-To: <aspKmWIrOzNjiP-t@gourry-fedora-PF4VCD3F>

On Sat, 10 Oct 2026 10:26:33 -0400 Gregory Price <gourry@gourry.net> wrote:

> > Signed-off-by: Wei Yang <albinwyang@tencent.com>
> > ---
> >  mm/madvise.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/mm/madvise.c b/mm/madvise.c
> > index eeee82cf2b3f..0755e6d99757 100644
> > --- a/mm/madvise.c
> > +++ b/mm/madvise.c
> > @@ -450,6 +450,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
> >  		spin_unlock(ptl);
> >  		if (pageout)
> >  			reclaim_pages(&folio_list);
> > +		cond_resched();
> >  		return 0;
> >  	}
> > 
> 
> This same improvement came naturally from refactoring the entire
> function into a proper pagewalk structure:
> 
> https://lore.kernel.org/linux-mm/20260922235830.2350770-10-gourry@gourry.net/

I'm thinking

Fixes: 9c276cc65a58 ("mm: introduce MADV_COLD")

Sep 25 2019.  So 5.x and 6.x kernels want this.  Current kernels
actually don't need this because PREEMPT_NONE has virtually
disappeared.  But 99%(?) of machines run 5.x and 6.x.

I'll go with Wei's simple one-liner for backportability & safety. 
Let's look at broader changes in future -rc cycles.


  reply	other threads:[~2026-10-10 20:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  2:40 albin_yang
2026-10-10 14:26 ` Gregory Price
2026-10-10 20:51   ` Andrew Morton [this message]
2026-10-12 12:58   ` Lorenzo Stoakes (ARM)
2026-10-12 13:32     ` Gregory Price
2026-10-12 13:49       ` Lorenzo Stoakes (ARM)
2026-10-12 11:02 ` David Hildenbrand (Arm)
2026-10-12 12:57   ` Lorenzo Stoakes (ARM)
2026-10-12 13:33 ` Gregory Price

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=20261010135116.7d2a4f3b1a25e54fe4617fb6@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=albin_yang@163.com \
    --cc=albinwyang@tencent.com \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=jannh@google.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=vbabka@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®