linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harry Yoo <harry.yoo@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>,
	yangshiguang1011@163.com, akpm@linux-foundation.org,
	cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev,
	glittao@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	yangshiguang <yangshiguang@xiaomi.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] mm: slub: avoid wake up kswapd in set_track_prepare
Date: Wed, 27 Aug 2025 14:17:31 +0900	[thread overview]
Message-ID: <aK6U61xNpJS0qs15@hyeyoo> (raw)
In-Reply-To: <54d9e5ac-5a51-4901-9b13-4c248aada2d7@suse.cz>

On Mon, Aug 25, 2025 at 05:42:52PM +0200, Vlastimil Babka wrote:
> On 8/25/25 14:40, Matthew Wilcox wrote:
> > On Mon, Aug 25, 2025 at 08:17:37PM +0800, yangshiguang1011@163.com wrote:
> >> Avoid deadlock caused by implicitly waking up kswapd by
> >> passing in allocation flags.
> > [...]
> >> +	/* Preemption is disabled in ___slab_alloc() */
> >> +	gfp_flags &= ~(__GFP_DIRECT_RECLAIM);
> > 
> > If you don't mean __GFP_KSWAPD_RECLAIM here, the explanation needs to
> > be better.
> 
> It was suggested by Harry here:
> https://lore.kernel.org/all/aKKhUoUkRNDkFYYb@harry
> 
> I think the comment is enough? Disabling preemption means we can't direct
> reclaim, but we can wake up kswapd. If the slab caller context is such that
> we can't, __GFP_KSWAPD_RECLAIM already won't be in the gfp_flags.

To make it a little bit more verbose, this ^^ explanation can be added to the
changelog?

> But I think we should mask our also __GFP_NOFAIL and add __GFP_NOWARN?

That sounds good.

> (we should get some common helpers for these kinds of gfp flag manipulations
> already)

Any ideas for its name?

gfp_dont_try_too_hard(),
gfp_adjust_lightweight(),
gfp_adjust_mayfail(),
...

I'm not good at naming :/

-- 
Cheers,
Harry / Hyeonggon

  reply	other threads:[~2025-08-27  5:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 12:17 [PATCH v3] mm: slub: avoid wake up kswapd in set_track_prepare yangshiguang1011
2025-08-25 12:40 ` Matthew Wilcox
2025-08-25 15:42   ` Vlastimil Babka
2025-08-27  5:17     ` Harry Yoo [this message]
2025-08-27  7:45       ` yangshiguang
2025-08-27  8:40         ` Vlastimil Babka
     [not found]           ` <4d271e7e.6bea.198f596bd15.Coremail.yangshiguang1011@163.com>
2025-08-29 13:08             ` Vlastimil Babka
2025-08-30  1:48               ` yangshiguang
2025-08-27  8:00       ` Vlastimil Babka
2025-08-27  8:44         ` Vlastimil Babka

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=aK6U61xNpJS0qs15@hyeyoo \
    --to=harry.yoo@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=glittao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=yangshiguang1011@163.com \
    --cc=yangshiguang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).