Re: [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apologies for the top posting.

+Ryan, I missed adding Ryan at the last moment :-)

On Thu, Mar 28, 2024 at 10:48 AM Barry Song <21cnbao@xxxxxxxxx> wrote:
>
> From: Barry Song <v-songbaohua@xxxxxxxx>
>
> 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@xxxxxxx/
> [2] https://lore.kernel.org/linux-mm/20240304081348.197341-1-21cnbao@xxxxxxxxx/
>
> 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
>





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux