Re: [PATCH v5 3/3] mm/zswap: reference the pool by id to shrink struct zswap_entry
From: Jianyue Wu
Date: Sat Sep 05 2026 - 09:21:03 EST
On Fri, Sep 4, 2026 at 11:38 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
> > +/*
> > + * The pool stays alive after this returns because a stored entry holds a
> > + * reference to its pool (taken in zswap_store_page()).
> > + */
> > +static struct zswap_pool *zswap_entry_pool(struct zswap_entry *entry)
> > +{
> > + struct zswap_pool *pool;
> > +
> > + rcu_read_lock();
> > + pool = xa_load(&zswap_pools, entry->pool_idx);
> > + rcu_read_unlock();
>
> Doesn't xa_load() already call rcu_read_[un]lock()?
>
Yes, xa_load() does the lookup under RCU internally, so the wrapping
rcu_read_lock()/unlock() is redundant, and will remove it.
Best regards,
Jianyue