Re: [PATCH v2] mm/page_alloc: don't wake kswapd from rmqueue() unless __GFP_KSWAPD_RECLAIM is specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/05/15 16:38, Mel Gorman wrote:
> On Sun, May 14, 2023 at 09:28:56AM +0900, Tetsuo Handa wrote:
>> Commit 73444bc4d8f9 ("mm, page_alloc: do not wake kswapd with zone lock
>> held") moved wakeup_kswapd() from steal_suitable_fallback() to rmqueue()
>> using ZONE_BOOSTED_WATERMARK flag.
>>
>> Only allocation contexts that include ALLOC_KSWAPD (which corresponds to
>> __GFP_KSWAPD_RECLAIM) should wake kswapd, for callers are supposed to
>> remove __GFP_KSWAPD_RECLAIM if trying to hold pgdat->kswapd_wait has a
>> risk of deadlock.
> 
> kswapd_wait is a waitqueue so what is being held? It's safe for kswapd
> to try wake itself as the waitqueue will be active when wakeup_kswapd()
> is called so no wakeup occurs. If there is a deadlock, it needs a better
> explanation. I believe I already stated why this patch is fixing a bug
> but it wasn't deadlock related.
> 

I noticed this problem ( pgdat->kswapd_wait might be held without
__GFP_KSWAPD_RECLAIM ) when analyzing a different problem ( debugobject code
is holding pgdat->kswapd_wait due to __GFP_KSWAPD_RECLAIM ) reported at
https://syzkaller.appspot.com/bug?extid=fe0c72f0ccbb93786380 .

I'm calling pgdat->kswapd_wait a lock, as lockdep uses it as a lock name.

The latter was explained at
https://lore.kernel.org/linux-mm/d642e597-cf7d-b410-16ce-22dff483fd8e@xxxxxxxxxxxxxxxxxxx/
and we agreed that debugobject code needs to drop __GFP_KSWAPD_RECLAIM at
https://lore.kernel.org/linux-mm/87fs809fwk.ffs@tglx/ .

This patch is for making sure that debugobject code will not try to hold
pgdat->kswapd_wait after debugobject code dropped __GFP_KSWAPD_RECLAIM.

Thus, the problem this patch will fix is a deadlock related, isn't it?





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux