[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27fb4f62-d656-449c-9f3c-5d0b61a88cca@intel.com>
Date: Thu, 4 Jul 2024 13:38:04 +0200
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
CC: <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Minchan Kim
<minchan@...nel.org>, Sergey Senozhatsky <senozhatsky@...omium.org>, "Jens
Axboe" <axboe@...nel.dk>, Thomas Gleixner <tglx@...utronix.de>, Mike
Galbraith <umgwanakikbuti@...il.com>
Subject: Re: [PATCH v2 1/3] zram: Replace bit spinlocks with a spinlock_t.
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Date: Thu, 20 Jun 2024 17:28:50 +0200
> From: Mike Galbraith <umgwanakikbuti@...il.com>
>
> 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.
>
> Add a spinlock_t for locking. Keep the set/ clear ZRAM_LOCK bit after
> the lock has been acquired/ dropped. The size of struct zram_table_entry
> increases by 4 bytes due to lock and additional 4 bytes padding with
> CONFIG_ZRAM_TRACK_ENTRY_ACTIME enabled.
>
> Signed-off-by: Mike Galbraith <umgwanakikbuti@...il.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> drivers/block/zram/zram_drv.c | 22 +++++++++++++++++++---
> drivers/block/zram/zram_drv.h | 1 +
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 3acd7006ad2cc..036845cd4f25e 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -57,19 +57,34 @@ static void zram_free_page(struct zram *zram, size_t index);
> static int zram_read_page(struct zram *zram, struct page *page, u32 index,
> struct bio *parent);
>
> +static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages)
> +{
> + size_t index;
> +
> + for (index = 0; index < num_pages; index++)
Maybe declare @index right here?
> + spin_lock_init(&zram->table[index].lock);
> +}
[...]
Thanks,
Olek
Powered by blists - more mailing lists