[PATCH v2 10/10] zram: use atomic64_xxx() to replace zram_stat64_xxx()

Jerome Marchand jmarchan at redhat.com
Wed Jun 5 12:02:12 UTC 2013

On 06/04/2013 06:06 PM, Jiang Liu wrote:
> Use atomic64_xxx() to replace open-coded zram_stat64_xxx().
> Some architectures have native support of atomic64 operations,
> so we can get rid of the spin_lock() in zram_stat64_xxx().
> On the other hand, for platforms use generic version of atomic64
> implement, it may cause an extra save/restore of the interrupt
> flag.  So it's a tradeoff.
> Signed-off-by: Jiang Liu <jiang.liu at huawei.com>

Before optimizing stats, I'd like to make sure that they're correct.
What makes 64 bits fields so different that they need atomicity while
32 bits wouldn't? Actually all of them save compr_size only increase,
which would make a race less critical than for 32 bits fields that all
can go up and down (if a decrement overwrites a increment, the counter
can wrap around zero).


More information about the devel mailing list