linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages
@ 2024-03-27 21:48 Barry Song
  2024-03-27 21:48 ` [PATCH RFC 1/2] mm: zsmalloc: support objects compressed based on multiple pages Barry Song
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Barry Song @ 2024-03-27 21:48 UTC (permalink / raw)
  To: akpm, minchan, senozhatsky, linux-block, axboe, linux-mm
  Cc: terrelln, chrisl, david, kasong, yuzhao, yosryahmed, nphamcs,
	willy, hannes, ying.huang, surenb, wajdi.k.feghali,
	kanchana.p.sridhar, corbet, zhouchengming, Barry Song

From: Barry Song <v-songbaohua@oppo.com>

mTHP is generally considered to potentially waste memory due to fragmentation,
but it may also serve as a source of memory savings.
When large folios are compressed at a larger granularity, we observe a remarkable
decrease in CPU utilization and a significant improvement in compression ratios.

The following data illustrates the time and compressed data for typical anonymous
pages gathered from Android phones.

granularity   orig_data_size   compr_data_size   time(us)
4KiB-zstd      1048576000       246876055        50259962
64KiB-zstd     1048576000       199763892        18330605

Due to mTHP's ability to be swapped out without splitting[1] and swapped in as a
whole[2], it enables compression and decompression to be performed at larger
granularities.

This patchset enhances zsmalloc and zram by introducing support for dividing large
folios into multi-pages, typically configured with a 4-order granularity. Here are
concrete examples:

* If a large folio's size is 32KiB, it will still be compressed and stored at a 4KiB
  granularity.
* If a large folio's size is 64KiB, it will be compressed and stored as a single 64KiB
  block.
* If a large folio's size is 128KiB, it will be compressed and stored as two 64KiB
  multi-pages.

Without the patchset, a large folio is always divided into nr_pages 4KiB blocks.

The granularity can be configured using the ZSMALLOC_MULTI_PAGES_ORDER setting.

[1] https://lore.kernel.org/linux-mm/20240327144537.4165578-1-ryan.roberts@arm.com/
[2] https://lore.kernel.org/linux-mm/20240304081348.197341-1-21cnbao@gmail.com/

Tangquan Zheng (2):
  mm: zsmalloc: support objects compressed based on multiple pages
  zram: support compression at the granularity of multi-pages

 drivers/block/zram/Kconfig    |   9 +
 drivers/block/zram/zcomp.c    |  23 ++-
 drivers/block/zram/zcomp.h    |  12 +-
 drivers/block/zram/zram_drv.c | 372 +++++++++++++++++++++++++++++++---
 drivers/block/zram/zram_drv.h |  21 ++
 include/linux/zsmalloc.h      |  10 +-
 mm/Kconfig                    |  18 ++
 mm/zsmalloc.c                 | 215 +++++++++++++++-----
 8 files changed, 586 insertions(+), 94 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-11-07 20:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 21:48 [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages Barry Song
2024-03-27 21:48 ` [PATCH RFC 1/2] mm: zsmalloc: support objects compressed based on multiple pages Barry Song
2024-10-21 23:26   ` Barry Song
2024-03-27 21:48 ` [PATCH RFC 2/2] zram: support compression at the granularity of multi-pages Barry Song
2024-04-11  0:40   ` Sergey Senozhatsky
2024-04-11  1:24     ` Barry Song
2024-04-11  1:42   ` Sergey Senozhatsky
2024-04-11  2:03     ` Barry Song
2024-04-11  4:14       ` Sergey Senozhatsky
2024-04-11  7:49         ` Barry Song
2024-04-19  3:41           ` Sergey Senozhatsky
2024-10-21 23:28   ` Barry Song
2024-11-06 16:23     ` Usama Arif
2024-11-07 10:25       ` Barry Song
2024-11-07 10:31         ` Barry Song
2024-11-07 11:49           ` Usama Arif
2024-11-07 20:53             ` Barry Song
2024-03-27 22:01 ` [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox