Re: [PATCH] zram: drop slot trylock and miss_free
From: Sergey Senozhatsky
Date: Tue Feb 10 2026 - 22:07:42 EST
On (26/02/10 14:29), Matthew Wilcox wrote:
> On Tue, Feb 10, 2026 at 12:50:37PM +0900, Sergey Senozhatsky wrote:
> > @@ -1943,15 +1927,9 @@ static ssize_t debug_stat_show(struct device *dev,
> > {
> > int version = 1;
> > struct zram *zram = dev_to_zram(dev);
> > - ssize_t ret;
> >
> > guard(rwsem_read)(&zram->dev_lock);
> > - ret = sysfs_emit(buf,
> > - "version: %d\n0 %8llu\n",
> > - version,
> > - (u64)atomic64_read(&zram->stats.miss_free));
> > -
> > - return ret;
> > + return sysfs_emit(buf, "version: %d\n0 0\n", version);
> > }
>
> You don't need the dev_lock any more to just report the version.
True. I'll think if I want to send out a v2 with just miss_free
removal. The objective was to remove trylock (and all the things
around it), but trylock has to stay. While we cannot have
slot_lock(42)
<IRQ>
slot_lock(42)
any more, the slot-free-notify is still called under spin_lock, and
slot_lock() might_sleep(). So trylock has to stay around.
> And should the version be changed now that you've changed the format to
> not include miss_free?
The idea was to bump the version only when the format changes. You
normally (well, technically "always", since e914d8f00391) would see
0 miss_free, and with the patch it's just a hard-coded 0.
Thanks for taking a look, Matthew.