From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
"Jens Axboe" <axboe@kernel.dk>,
Thomas Gleixner <tglx@linutronix.de>,
Mike Galbraith <umgwanakikbuti@gmail.com>
Subject: Re: [PATCH v2 1/3] zram: Replace bit spinlocks with a spinlock_t.
Date: Thu, 4 Jul 2024 13:38:04 +0200 [thread overview]
Message-ID: <27fb4f62-d656-449c-9f3c-5d0b61a88cca@intel.com> (raw)
In-Reply-To: <20240620153556.777272-2-bigeasy@linutronix.de>
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 20 Jun 2024 17:28:50 +0200
> From: Mike Galbraith <umgwanakikbuti@gmail.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@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.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
next prev parent reply other threads:[~2024-07-04 11:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 15:28 [PATCH v2 0/3] " Sebastian Andrzej Siewior
2024-06-20 15:28 ` [PATCH v2 1/3] " Sebastian Andrzej Siewior
2024-07-04 11:38 ` Alexander Lobakin [this message]
2024-07-04 12:19 ` Sebastian Andrzej Siewior
2024-07-05 12:02 ` Alexander Lobakin
2024-07-05 12:23 ` Sebastian Andrzej Siewior
2024-07-08 3:03 ` Sergey Senozhatsky
2024-07-08 3:32 ` Sergey Senozhatsky
2024-06-20 15:28 ` [PATCH v2 2/3] zram: Remove ZRAM_LOCK Sebastian Andrzej Siewior
2024-06-20 15:28 ` [PATCH v2 3/3] zram: Shrink zram_table_entry::flags Sebastian Andrzej Siewior
2024-07-04 9:39 ` [PATCH v2 0/3] zram: Replace bit spinlocks with a spinlock_t Sergey Senozhatsky
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=27fb4f62-d656-449c-9f3c-5d0b61a88cca@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=axboe@kernel.dk \
--cc=bigeasy@linutronix.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.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
all inboxes | Powered by JetHome®