[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206082635.dZ1qhyhU@linutronix.de>
Date: Thu, 6 Feb 2025 09:26:35 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Hillf Danton <hdanton@...a.com>,
Mike Galbraith <umgwanakikbuti@...il.com>
Subject: Re: [PATCHv4 01/17] zram: switch to non-atomic entry locking
On 2025-02-06 17:17:41 [+0900], Sergey Senozhatsky wrote:
> > Okay. So there are requirements for the sleeping lock. A mutex isn't
> > fitting the requirement because it is too large I guess.
>
> Correct.
I would nice to state this why a generic locking implementation can not
be used. From what I have seen it should play along with RT nicely.
> > > > > static void zram_slot_lock(struct zram *zram, u32 index)
> > > > > {
> > > > > unsigned long *lock = &zram->table[index].flags;
> > > > >
> > > > > WARN_ON_ONCE(!preemptible());
> > > >
> > > > you want might_sleep() here instead. preemptible() works only on
> > > > preemptible kernels. And might_sleep() is already provided by
> > > > wait_on_bit_lock(). So this can go.
> > >
> > > wait_on_bit_lock() has might_sleep().
> >
> > My point exactly. This makes the WARN_ON_ONCE() obsolete.
>
> Right, might_sleep() can be disabled, as far as I understand,
> via CONFIG_DEBUG_ATOMIC_SLEEP, unlike WARN_ON_ONCE(). But I
> can drop it and then just rely on might_sleep(), should be
> enough.
It should be enough. mutex_lock(), down() and so on relies solely on it.
As I said, preemptible() only works on preemptible kernels if it comes
to the preemption counter on and !preemptible kernels with enabled
debugging.
Sebastian
Powered by blists - more mailing lists