Re: [PATCH v2] zram: keep the hot statistics per CPU
From: Weijie Yuan
Date: Sun Dec 06 2026 - 03:06:13 EST
On Sun, Dec 06, 2026 at 02:29:06PM +0900, Sergey Senozhatsky wrote:
> When several processes free swapped out memory at the same time, e.g. on
> munmap() or exit, all CPUs update pages_stored, compr_data_size,
> same_pages, huge_pages, huge_pages_since and notify_free stats, so the
> cachelines bounce a lot [1]. Keep the six counters per CPU instead, as
> s64 + u64_stats_sync updated with preemption disabled.
>
> munmap() test:
> before after
> 4 x 256 MiB 18.69 ms 14.12 ms (-24%)
> 8 x 128 MiB 14.82 ms 10.09 ms (-32%)
>
> Link: https://patch.msgid.link/20261123054746.2579253-3-senozhatsky@xxxxxxxxxxxx
> Link: https://lore.kernel.org/20261017031542.3504947-1-hongfengchen@xxxxxxxxxx [1]
> Signed-off-by: Hongfeng Chen <hongfengchen@xxxxxxxxxx>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> Co-developed-by: Hongfeng Chen <hongfengchen@xxxxxxxxxx>
> ---
Just a drive-by nit: SubmittingPatches asks to move Hongfeng's
Co-developed-by line right above his Signed-off-by.
https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
Thanks.
> drivers/block/zram/zram_drv.c | 116 ++++++++++++++++++++++++++--------
> drivers/block/zram/zram_drv.h | 27 ++++++--
> 2 files changed, 110 insertions(+), 33 deletions(-)