Re: [PATCH] zram: Replace bit spinlocks with spinlock_t for PREEMPT_RT.
From: Sergey Senozhatsky
Date: Fri Mar 24 2023 - 00:08:04 EST
On (23/03/23 17:18), Sebastian Andrzej Siewior wrote:
> From: Mike Galbraith <umgwanakikbuti@xxxxxxxxx>
>
> The bit spinlock disables preemption. The spinlock_t lock becomes a sleeping
> lock on PREEMPT_RT and it can not be acquired in this context. In this locked
> section, zs_free() acquires a zs_pool::lock, and there is access to
> zram::wb_limit_lock.
>
> Use a spinlock_t on PREEMPT_RT for locking and set/ clear ZRAM_LOCK bit after
> the lock has been acquired/ dropped.
>
> Signed-off-by: Mike Galbraith <umgwanakikbuti@xxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/YqIbMuHCPiQk+Ac2@xxxxxxxxxxxxx
> ---
>
> I'm simply forwarding Mike's patch here. The other alternative is to let
> the driver depend on !PREEMPT_RT. I can't tell likely it is that this
> driver is used. Mike most likely stumbled upon it while running LTP.
Yeah, I'm curious if anyone uses zram in preempt-rt systems. I don't
mind this patch but would be nice to add new code when it solves some
real problems. Maybe `depend on !PREEMPT_RT` can be a better option.