[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc6f7372-efb4-48e3-b217-c8bec0065b97@suse.cz>
Date: Wed, 27 Aug 2025 10:40:21 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: yangshiguang <yangshiguang1011@....com>, Harry Yoo <harry.yoo@...cle.com>
Cc: Matthew Wilcox <willy@...radead.org>, akpm@...ux-foundation.org,
cl@...two.org, rientjes@...gle.com, roman.gushchin@...ux.dev,
glittao@...il.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
yangshiguang <yangshiguang@...omi.com>, stable@...r.kernel.org
Subject: Re: [PATCH v3] mm: slub: avoid wake up kswapd in set_track_prepare
On 8/27/25 09:45, yangshiguang wrote:
>
>
>
>
> At 2025-08-27 13:17:31, "Harry Yoo" <harry.yoo@...cle.com> wrote:
>>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@....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?
>
>
> ok, will be easier to understand.
>
>>
>>> 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 :/
>
>>
>
> How about this?
>
> /* Preemption is disabled in ___slab_alloc() */
> - gfp_flags &= ~(__GFP_DIRECT_RECLAIM);
> + gfp_flags = (gfp_flags & ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL)) |
> + __GFP_NOWARN;
I'd suggest using gfp_nested_flags() and & ~(__GFP_DIRECT_RECLAIM);
> >--
>>Cheers,
>>Harry / Hyeonggon
Powered by blists - more mailing lists