Re: [PATCH v7] zswap: replace RB tree with xarray

From: Yosry Ahmed
Date: Wed Mar 20 2024 - 15:46:48 EST


On Wed, Mar 20, 2024 at 12:41:48PM -0700, Chris Li wrote:
> On Wed, Mar 20, 2024 at 12:34 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> > > you can expect it to be coherent.
> >
> > Fair enough, but don't we still need a barrier there? Couldn't some
> > initializations still be reorder after zswap_lru_add()?
>
> I am under the impression that the lru list handling function already
> handles the barrier. If an explicit barrier is needed, wouldn't all
> other lru callers have barriers sprinkling all over the place?

list_lru_add() holds a lock, which implies a compiler barrier. I was
wondering if we need smp_wmb() to prevent other CPUs from observing a
partially initialized entry during writeback.

I am not sure if the list lru makes such assumptions about the need for
barriers.