Re: [PATCH 2/5] zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locks

From: Sergey Senozhatsky
Date: Tue Nov 01 2022 - 23:29:38 EST


On (22/10/26 13:06), Nhat Pham wrote:
> struct size_class {
> - spinlock_t lock;
> struct list_head fullness_list[NR_ZS_FULLNESS];
> /*
> * Size of objects stored in this class. Must be multiple
> @@ -247,8 +245,7 @@ struct zs_pool {
> #ifdef CONFIG_COMPACTION
> struct work_struct free_work;
> #endif
> - /* protect page/zspage migration */
> - rwlock_t migrate_lock;
> + spinlock_t lock;
> };

I'm not in love with this, to be honest. One big pool lock instead
of 255 per-class locks doesn't look attractive, as one big pool lock
is going to be hammered quite a lot when zram is used, e.g. as a regular
block device with a file system and is under heavy parallel writes/reads.