From: Barry Song <21cnbao@gmail.com>
To: nphamcs@gmail.com, hannes@cmpxchg.org
Cc: 21cnbao@gmail.com, akpm@linux-foundation.org,
andrew.yang@mediatek.com,
angelogioacchino.delregno@collabora.com, casper.li@mediatek.com,
chinwen.chang@mediatek.com, james.hsu@mediatek.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-mm@kvack.org, matthias.bgg@gmail.com, minchan@kernel.org,
qun-wei.lin@mediatek.com, rppt@kernel.org,
senozhatsky@chromium.org
Subject: Re: [PATCH] mm: Add Kcompressd for accelerated memory compression
Date: Mon, 16 Jun 2025 15:41:06 +1200 [thread overview]
Message-ID: <20250616034106.1978-1-21cnbao@gmail.com> (raw)
In-Reply-To: <CAKEwX=MsP6LGjMRNyaHnO5MkE_ne-u-cKLbGfVQcSR-ALoxBwA@mail.gmail.com>
Hi Nhat, Johannes,
>> The way you implemented this adds time-and-space overhead even on
>> systems that don't have any sort of swap compression enabled.
I agree — we can eliminate the time and space overhead by refining the
code to hook kcompressed only when zswap or zram is enabled.
>>
>> That seems unnecessary. There is an existing method for asynchronous
>> writeback, and pageout() is naturally fully set up to handle this.
>>
>> IMO the better way to do this is to make zswap_store() (and
>> zram_bio_write()?) asynchronous. Make those functions queue the work
>> and wake the compression daemon, and then have the daemon call
>> folio_end_writeback() / bio_endio() when it's done with it.
> +1.
But,
How could this be possible for zswap? zswap_store() is only a frontend —
we still need its return value to determine whether __swap_writepage()
is required. Waiting for the result of zswap_store() is inherently a
synchronous step.
My point is that folio_end_writeback() and bio_endio() can only be
called after the entire zswap_store() → __swap_writepage() sequence is
completed. That’s why both are placed in the new kcompressed.
The use of folio_end_writeback() and bio_endio() was the case for zRAM
in Qun-Wei's RFC.
https://lore.kernel.org/linux-mm/20250307120141.1566673-3-qun-wei.lin@mediatek.com/
However, the implementation tightly coupled zRAM with reclamation logic.
For example, zRAM needed to know whether it was running in the kswapd
context, which is not ideal for a generic block device — the role zRAM
is supposed to play. Additionally, the code was not shared between zswap
and zRAM.
Thanks
Barry
next prev parent reply other threads:[~2025-06-16 3:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 8:26 Qun-Wei Lin
2025-04-30 17:05 ` Nhat Pham
2025-04-30 17:22 ` Nhat Pham
2025-04-30 21:51 ` Andrew Morton
2025-04-30 22:49 ` Barry Song
2025-05-07 15:11 ` Nhat Pham
2025-05-01 14:02 ` Johannes Weiner
2025-05-01 15:12 ` Nhat Pham
2025-06-16 3:41 ` Barry Song [this message]
2025-06-17 14:21 ` Nhat Pham
2025-06-23 5:16 ` Barry Song
2025-06-27 23:21 ` Nhat Pham
2025-07-09 3:25 ` Qun-wei Lin (林群崴)
2025-05-02 9:16 ` Qun-wei Lin (林群崴)
2025-05-01 15:50 ` Nhat Pham
2025-05-07 1:12 ` Harry Yoo
2025-05-07 1:50 ` Zi Yan
2025-05-07 2:04 ` Barry Song
2025-05-07 15:00 ` Nhat Pham
2025-05-07 15:12 ` Zi Yan
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=20250616034106.1978-1-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrew.yang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=casper.li@mediatek.com \
--cc=chinwen.chang@mediatek.com \
--cc=hannes@cmpxchg.org \
--cc=james.hsu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=matthias.bgg@gmail.com \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=qun-wei.lin@mediatek.com \
--cc=rppt@kernel.org \
--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