lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250616034106.1978-1-21cnbao@gmail.com>
Date: Mon, 16 Jun 2025 15:41:06 +1200
From: Barry Song <21cnbao@...il.com>
To: nphamcs@...il.com,
	hannes@...xchg.org
Cc: 21cnbao@...il.com,
	akpm@...ux-foundation.org,
	andrew.yang@...iatek.com,
	angelogioacchino.delregno@...labora.com,
	casper.li@...iatek.com,
	chinwen.chang@...iatek.com,
	james.hsu@...iatek.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	linux-mediatek@...ts.infradead.org,
	linux-mm@...ck.org,
	matthias.bgg@...il.com,
	minchan@...nel.org,
	qun-wei.lin@...iatek.com,
	rppt@...nel.org,
	senozhatsky@...omium.org
Subject: Re: [PATCH] mm: Add Kcompressd for accelerated memory compression

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ