linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <chengming.zhou@linux.dev>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	yosryahmed@google.com, nphamcs@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH mm-unstable hotfix] mm/zswap: fix zswap_pools_lock usages after changing to percpu_ref
Date: Wed, 28 Feb 2024 23:37:44 +0800	[thread overview]
Message-ID: <1d920f2c-2f86-46b9-b5d9-b5615284e5c3@linux.dev> (raw)
In-Reply-To: <Zd9QFkE2nr5FyYDq@casper.infradead.org>

On 2024/2/28 23:24, Matthew Wilcox wrote:
> 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?

You're right, it's the softirq context, so spin_lock_bh() is enough.

Thanks!


  reply	other threads:[~2024-02-28 15:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  8:55 [PATCH v3 0/2] mm/zswap: optimize for dynamic zswap_pools Chengming Zhou
2024-02-16  8:55 ` [PATCH v3 1/2] mm/zswap: global lru and shrinker shared by all zswap_pools Chengming Zhou
2024-02-20  1:28   ` Nhat Pham
2024-02-20  3:24     ` Chengming Zhou
2024-03-05  7:53   ` [PATCH mm-unstable] mm/zswap: global lru and shrinker shared by all zswap_pools fix Chengming Zhou
2024-03-05 15:09     ` Johannes Weiner
2024-02-16  8:55 ` [PATCH v3 2/2] mm/zswap: change zswap_pool kref to percpu_ref Chengming Zhou
2024-02-16 10:41   ` Nhat Pham
2024-02-28 15:18   ` [PATCH mm-unstable hotfix] mm/zswap: fix zswap_pools_lock usages after changing " Chengming Zhou
2024-02-28 15:24     ` Matthew Wilcox
2024-02-28 15:37       ` Chengming Zhou [this message]
2024-02-28 15:49   ` [PATCH mm-unstable v2] " Chengming Zhou

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=1d920f2c-2f86-46b9-b5d9-b5615284e5c3@linux.dev \
    --to=chengming.zhou@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=willy@infradead.org \
    --cc=yosryahmed@google.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