From: Vlastimil Babka <vbabka@suse.cz>
To: David Rientjes <rientjes@google.com>, yangshiguang1011@163.com
Cc: harry.yoo@oracle.com, akpm@linux-foundation.org, cl@gentwo.org,
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 v4] mm: slub: avoid wake up kswapd in set_track_prepare
Date: Mon, 1 Sep 2025 10:15:04 +0200 [thread overview]
Message-ID: <7f30ddd1-c6f7-4b2b-a2b9-875844092e28@suse.cz> (raw)
In-Reply-To: <c8f6933e-f733-4f86-c09d-8028ad862f33@google.com>
On 9/1/25 09:50, David Rientjes wrote:
> On Sat, 30 Aug 2025, yangshiguang1011@163.com wrote:
>
>> From: yangshiguang <yangshiguang@xiaomi.com>
>>
>> From: yangshiguang <yangshiguang@xiaomi.com>
>>
>
> Duplicate lines.
>
>> set_track_prepare() can incur lock recursion.
>> The issue is that it is called from hrtimer_start_range_ns
>> holding the per_cpu(hrtimer_bases)[n].lock, but when enabled
>> CONFIG_DEBUG_OBJECTS_TIMERS, may wake up kswapd in set_track_prepare,
>> and try to hold the per_cpu(hrtimer_bases)[n].lock.
>>
>> Avoid deadlock caused by implicitly waking up kswapd by
>> passing in allocation flags. And the slab caller context has
>> preemption disabled, so __GFP_KSWAPD_RECLAIM must not appear in gfp_flags.
>>
>
> This mentions __GFP_KSWAPD_RECLAIM, but the patch actually masks off
> __GFP_DIRECT_RECLAIM which would be a heavierweight operation. Disabling
> direct reclaim does not necessarily imply that kswapd will be disabled as
> well.
Yeah I think the changelog should say __GFP_DIRECT_RECLAIM.
> Are you meaning to clear __GFP_RECLAIM in set_track_prepare()?
No because if the context context (e.g. the hrtimers) can't support
__GFP_KSWAPD_RECLAIM it won't have it in gfp_flags and we now pass them to
set_track_prepare() so it already won't be there.
next prev parent reply other threads:[~2025-09-01 8:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 2:09 yangshiguang1011
2025-09-01 7:50 ` David Rientjes
2025-09-01 8:15 ` Vlastimil Babka [this message]
2025-09-01 8:29 ` yangshiguang
2025-09-01 8:46 ` Vlastimil Babka
2025-09-01 9:00 ` yangshiguang
2025-09-01 9:14 ` 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=7f30ddd1-c6f7-4b2b-a2b9-875844092e28@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=glittao@gmail.com \
--cc=harry.yoo@oracle.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=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