public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Nhat Pham <nphamcs@gmail.com>, Barry Song <21cnbao@gmail.com>
Cc: Qun-Wei Lin <qun-wei.lin@mediatek.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/2] kcompressd: Add Kcompressd for accelerated zram compression
Date: Sun,  9 Mar 2025 09:05:22 +0800	[thread overview]
Message-ID: <20250309010541.3152-1-hdanton@sina.com> (raw)
In-Reply-To: <CAKEwX=OP9PJ9YeUvy3ZMQPByH7ELHLDfeLuuYKvPy3aCQCAJwQ@mail.gmail.com>

On Fri, 7 Mar 2025 15:13:12 -0800 Nhat Pham <nphamcs@gmail.com>
> On Fri, Mar 7, 2025 at 11:41 AM Barry Song <21cnbao@gmail.com> wrote:
> > On Sat, Mar 8, 2025 at 1:02 AM Qun-Wei Lin <qun-wei.lin@mediatek.com> wrote:
> > >
> > > Introduced Kcompressd to offload zram page compression, improving
> > > system efficiency by handling compression separately from memory
> > > reclaiming. Added necessary configurations and dependencies.
> > >
> > > Signed-off-by: Qun-Wei Lin <qun-wei.lin@mediatek.com>
> > > ---
> > >  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   |  22 ++-
> > >  5 files changed, 397 insertions(+), 4 deletions(-)
> > >  create mode 100644 drivers/block/zram/kcompressd.c
> > >  create mode 100644 drivers/block/zram/kcompressd.h
> > >
> > > diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
> > > index 402b7b175863..f0a1b574f770 100644
> > > --- a/drivers/block/zram/Kconfig
> > > +++ b/drivers/block/zram/Kconfig
> > > @@ -145,3 +145,14 @@ config ZRAM_MULTI_COMP
> > >           re-compress pages using a potentially slower but more effective
> > >           compression algorithm. Note, that IDLE page recompression
> > >           requires ZRAM_TRACK_ENTRY_ACTIME.
> > > +
> > > +config KCOMPRESSD
> > > +       tristate "Kcompressd: Accelerated zram compression"
> > > +       depends on ZRAM
> > > +       help
> > > +         Kcompressd creates multiple daemons to accelerate the compression of pages
> > > +         in zram, offloading this time-consuming task from the zram driver.
> > > +
> > > +         This approach improves system efficiency by handling page compression separately,
> > > +         which was originally done by kswapd or direct reclaim.
> >
> > For direct reclaim, we were previously able to compress using multiple CPUs
> > with multi-threading.
> > After your patch, it seems that only a single thread/CPU is used for compression
> > so it won't necessarily improve direct reclaim performance?
> >
> > Even for kswapd, we used to have multiple threads like [kswapd0], [kswapd1],
> > and [kswapd2] for different nodes. Now, are we also limited to just one thread?
> > I also wonder if this could be handled at the vmscan level instead of the zram
> > level. then it might potentially help other sync devices or even zswap later.
> 
> Agree. A shared solution would be much appreciated. We can keep the
> kcompressd idea, but have it accept IO work from multiple sources
> (zram, zswap, whatever) through a shared API.
> 
> Otherwise we would need to reinvent the wheel multiple times :)
>
Could you explain what nr_kcompressd means, Qun-Wei, to quiesce barking lads?

  parent reply	other threads:[~2025-03-09  1:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 12:01 [PATCH 0/2] Improve Zram by separating compression context from kswapd Qun-Wei Lin
2025-03-07 12:01 ` [PATCH 1/2] mm: Split BLK_FEAT_SYNCHRONOUS and SWP_SYNCHRONOUS_IO into separate read and write flags Qun-Wei Lin
2025-03-07 12:01 ` [PATCH 2/2] kcompressd: Add Kcompressd for accelerated zram compression Qun-Wei Lin
2025-03-07 19:41   ` Barry Song
2025-03-07 23:13     ` Nhat Pham
2025-03-07 23:14       ` Nhat Pham
2025-03-10 13:26         ` Qun-wei Lin (林群崴)
2025-03-09  1:05       ` Hillf Danton [this message]
2025-03-09 19:56         ` Nhat Pham
2025-03-09 20:44           ` Barry Song
2025-03-09 22:20             ` Nhat Pham
2025-03-10 13:23               ` Qun-wei Lin (林群崴)
2025-03-10 10:34             ` Hillf Danton
2025-03-10 17:44               ` Barry Song
2025-03-10 23:08                 ` Hillf Danton
2025-03-11  3:57                   ` Barry Song
2025-03-11  6:36                     ` Greg KH
2025-03-11  5:02       ` Sergey Senozhatsky
2025-03-10 13:26     ` Qun-wei Lin (林群崴)
2025-03-11  7:05       ` Barry Song
2025-03-11  7:25         ` Barry Song
2025-03-11 14:33         ` Qun-wei Lin (林群崴)
2025-03-07 19:34 ` [PATCH 0/2] Improve Zram by separating compression context from kswapd Barry Song
2025-03-10 13:21   ` Qun-wei Lin (林群崴)
2025-03-07 23:03 ` Nhat Pham
2025-03-08  5:41   ` Barry Song
2025-03-10 13:22     ` Qun-wei Lin (林群崴)
2025-03-10 16:58       ` Nhat Pham
2025-03-10 17:30         ` Nhat Pham
2025-03-11  4:58     ` Sergey Senozhatsky
2025-03-11  9:33       ` Barry Song
2025-03-11 14:12         ` Qun-wei Lin (林群崴)
2025-03-12  5:19           ` Sergey Senozhatsky
2025-03-12 18:11 ` Minchan Kim
2025-03-13  3:09   ` Sergey Senozhatsky
2025-03-13  3:52     ` Barry Song
2025-03-13  9:30       ` Barry Song
     [not found]     ` <CAGsJ_4xwnVxn1odj=j+z0VXm1DRUmnhugnwCH-coqBLJweDu9Q@mail.gmail.com>
2025-03-13 16:07       ` Minchan Kim
2025-03-13 16:58         ` Barry Song
2025-03-13 17:33           ` Minchan Kim
2025-03-13 20:37             ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250309010541.3152-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=21cnbao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=qun-wei.lin@mediatek.com \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox