[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb41cab3-5946-4fe3-a1be-843dd6fca159@kernel.dk>
Date: Mon, 30 Jun 2025 09:24:34 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Yu Kuai <yukuai1@...weicloud.com>, hch@....de, yukuai3@...wei.com
Cc: penguin-kernel@...ove.SAKURA.ne.jp, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: Re: [PATCH v2] brd: fix sleeping function called from invalid context
in brd_insert_page()
On 6/30/25 5:28 AM, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@...wei.com>
>
> __xa_cmpxchg() is called with rcu_read_lock(), and it will allocate
> memory if necessary.
>
> Fix the problem by moving rcu_read_lock() after __xa_cmpxchg(), meanwhile,
> it still should be held before xa_unlock(), prevent returned page to be
> freed by concurrent discard.
The rcu locking in there is a bit of a mess, imho. What _exactly_ is the
rcu read side locking protecting? Is it only needed around the lookup
and insert? We even hold it over the kmap and copy, which seems very
heavy handed.
--
Jens Axboe
Powered by blists - more mailing lists