On Thu, Mar 13, 2025 at 4:09 PM Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote: > > On (25/03/12 11:11), Minchan Kim wrote: > > On Fri, Mar 07, 2025 at 08:01:02PM +0800, Qun-Wei Lin wrote: > > > This patch series introduces a new mechanism called kcompressd to > > > improve the efficiency of memory reclaiming in the operating system. The > > > main goal is to separate the tasks of page scanning and page compression > > > into distinct processes or threads, thereby reducing the load on the > > > kswapd thread and enhancing overall system performance under high memory > > > pressure conditions. > > > > > > Problem: > > > In the current system, the kswapd thread is responsible for both > > > scanning the LRU pages and compressing pages into the ZRAM. This > > > combined responsibility can lead to significant performance bottlenecks, > > > especially under high memory pressure. The kswapd thread becomes a > > > single point of contention, causing delays in memory reclaiming and > > > overall system performance degradation. > > > > Isn't it general problem if backend for swap is slow(but synchronous)? > > I think zram need to support asynchrnous IO(can do introduce multiple > > threads to compress batched pages) and doesn't declare it's > > synchrnous device for the case. > > The current conclusion is that kcompressd will sit above zram, > because zram is not the only compressing swap backend we have. also. it is not good to hack zram to be aware of if it is kswapd , direct reclaim , proactive reclaim and block device with mounted filesystem. so i am thinking sth as below page_io.c if (sync_device or zswap_enabled()) schedule swap_writepage to a separate per-node thread btw, ran the current patchset with one thread(not default 4) on phones and saw 50%+ allocstall reduction. so the idea looks like a good direction to go. Thanks Barry