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

From: Minchan Kim
Date: Wed Nov 02 2022 - 17:36:46 EST


On Wed, Nov 02, 2022 at 12:28:56PM +0900, Sergey Senozhatsky wrote:
> 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.
>
I agree with Sergey.

I am also worry about that LRU stuff should be part of allocator
instead of higher level.