[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zd9QFkE2nr5FyYDq@casper.infradead.org>
Date: Wed, 28 Feb 2024 15:24:06 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Chengming Zhou <chengming.zhou@...ux.dev>
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, yosryahmed@...gle.com,
nphamcs@...il.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH mm-unstable hotfix] mm/zswap: fix zswap_pools_lock usages
after changing to percpu_ref
On Wed, Feb 28, 2024 at 03:18:32PM +0000, Chengming Zhou wrote:
> Now the release of zswap pool is controlled by percpu_ref, its release
> callback (__zswap_pool_empty()) will be called when percpu_ref hit 0.
> But this release callback may potentially be called from RCU callback
> context by percpu_ref_kill(), which maybe in the interrupt context.
>
> So we need to use spin_lock_irqsave() and spin_unlock_irqrestore()
> in the release callback: __zswap_pool_empty(). In other task context
> places, spin_lock_irq() and spin_unlock_irq() are enough to avoid
> potential deadlock.
RCU callback context is BH, not IRQ, so it's enough to use
spin_lock_bh(), no?
Powered by blists - more mailing lists