[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307120141.1566673-1-qun-wei.lin@mediatek.com>
Date: Fri, 7 Mar 2025 20:01:02 +0800
From: Qun-Wei Lin <qun-wei.lin@...iatek.com>
To: Jens Axboe <axboe@...nel.dk>, Minchan Kim <minchan@...nel.org>, Sergey
Senozhatsky <senozhatsky@...omium.org>, Vishal Verma
<vishal.l.verma@...el.com>, Dan Williams <dan.j.williams@...el.com>, Dave
Jiang <dave.jiang@...el.com>, Ira Weiny <ira.weiny@...el.com>, Andrew Morton
<akpm@...ux-foundation.org>, Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, Chris
Li <chrisl@...nel.org>, Ryan Roberts <ryan.roberts@....com>, "Huang, Ying"
<ying.huang@...el.com>, Kairui Song <kasong@...cent.com>, Dan Schatzberg
<schatzberg.dan@...il.com>, Barry Song <baohua@...nel.org>, Al Viro
<viro@...iv.linux.org.uk>
CC: <linux-kernel@...r.kernel.org>, <linux-block@...r.kernel.org>,
<nvdimm@...ts.linux.dev>, <linux-mm@...ck.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mediatek@...ts.infradead.org>,
Casper Li <casper.li@...iatek.com>, Chinwen Chang
<chinwen.chang@...iatek.com>, Andrew Yang <andrew.yang@...iatek.com>, James
Hsu <james.hsu@...iatek.com>, Qun-Wei Lin <qun-wei.lin@...iatek.com>
Subject: [PATCH 0/2] Improve Zram by separating compression context from kswapd
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.
Target:
The target of this invention is to improve the efficiency of memory
reclaiming. By separating the tasks of page scanning and page
compression into distinct processes or threads, the system can handle
memory pressure more effectively.
Patch 1:
- Introduces 2 new feature flags, BLK_FEAT_READ_SYNCHRONOUS and
SWP_READ_SYNCHRONOUS_IO.
Patch 2:
- Implemented the core functionality of Kcompressd and made necessary
modifications to the zram driver to support it.
In our handheld devices, we found that applying this mechanism under high
memory pressure scenarios can increase the rate of pgsteal_anon per second
by over 260% compared to the situation with only kswapd.
Qun-Wei Lin (2):
mm: Split BLK_FEAT_SYNCHRONOUS and SWP_SYNCHRONOUS_IO into separate
read and write flags
kcompressd: Add Kcompressd for accelerated zram compression
drivers/block/brd.c | 3 +-
drivers/block/zram/Kconfig | 11 ++
drivers/block/zram/Makefile | 3 +-
drivers/block/zram/kcompressd.c | 340 ++++++++++++++++++++++++++++++++
drivers/block/zram/kcompressd.h | 25 +++
drivers/block/zram/zram_drv.c | 21 +-
drivers/nvdimm/btt.c | 3 +-
drivers/nvdimm/pmem.c | 5 +-
include/linux/blkdev.h | 24 ++-
include/linux/swap.h | 31 +--
mm/memory.c | 4 +-
mm/page_io.c | 6 +-
mm/swapfile.c | 7 +-
13 files changed, 446 insertions(+), 37 deletions(-)
create mode 100644 drivers/block/zram/kcompressd.c
create mode 100644 drivers/block/zram/kcompressd.h
--
2.45.2
Powered by blists - more mailing lists