Re: [PATCH v5 01/18] zram: sleepable entry locking
From: Sergey Senozhatsky
Date: Wed Feb 12 2025 - 20:43:10 EST
On (25/02/13 09:52), Sergey Senozhatsky wrote:
> > > -static int zram_slot_trylock(struct zram *zram, u32 index)
> > > +static void zram_slot_lock_init(struct zram *zram, u32 index)
> > > {
> > > - return spin_trylock(&zram->table[index].lock);
> > > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > > + lockdep_init_map(&zram->table[index].lockdep_map, "zram-entry->lock",
> > > + &zram->table_lockdep_key, 0);
> > > +#endif
> > > +}
> > > +
> > >
> > > ...
> > >
> > > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > > + lockdep_register_key(&zram->table_lockdep_key);
> > > +#endif
> > > +
> >
> > Please check whether all the ifdefs are needed - some of these things
> > have CONFIG_LOCKDEP=n stubs.
The problem is that while functions have LOCKDEP=n stubs, struct members
don't - we still declare table_lockdep_key and lockdep_map only when
DEBUG_LOCK_ALLOC is enabled.