Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Yosry Ahmed" <yosry@kernel.org>, "Nhat Pham" <nphamcs@gmail.com>,
	"Barry Song" <baohua@kernel.org>
Cc: "Brian Geffon" <bgeffon@google.com>,
	"Minchan Kim" <minchan@kernel.org>,
	"Richard Chang" <richardycc@google.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Chengming Zhou" <chengming.zhou@linux.dev>,
	"Xueyuan Chen" <xueyuan.chen21@gmail.com>,
	"Xueyuan Chen" <xueyuan.chen@vivo.com>,
	"Nanzhe Zhao" <nzzhao@126.com>,
	linux-mm@kvack.org, "Chris Wiseman" <chriswiseman@google.com>
Subject: Re: [RFC PATCH 1/4] mm/zsmalloc: remove shrinker
Date: Fri, 04 Dec 2026 10:14:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-249579@kernel.org> (raw)
In-Reply-To: <20261203101411.3609533-2-senozhatsky@chromium.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm/zsmalloc: removing name causes cacheline false sharing in
  struct zs_pool
--

commit 2d6bd115e9473ab90f0a6f836b8d71968644c949
Author: Chris Wiseman <chriswiseman@google.com>

mm/zsmalloc: remove shrinker

This commit removes zsmalloc's automatic compaction shrinker along with
its callbacks, registration, and the now-unused pool->name field.

Link: https://lore.kernel.org/cover.1786003779.git.xueyuan.chen@vivo.com

> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index f263bd2b8d468..17ef924f748bd 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c

[ ... ]

> @@ -270,17 +269,12 @@ struct link_free {
>  static struct kmem_cache *zspage_cachep;
>  
>  struct zs_pool {
> -	const char *name;
> -
>  	struct size_class *size_class[ZS_SIZE_CLASSES];
>  
>  	atomic_long_t pages_allocated;

[Severity: Medium]
Does removing name introduce cacheline false sharing between size_class[]
and pages_allocated?

On 4K-page 64-bit kernels, size_class[255] is 2040 bytes, so the 8-byte
name pointer previously aligned it to offset 2048.  Without name,
pages_allocated shifts to offset 2040 and shares cacheline 31 with
read-only size_class[248..254], including the huge class at index 254.

Every zspage allocation in zs_store() and free in zs_free() updates
pages_allocated atomically, bouncing that cacheline against concurrent
hot-path reads of size_class[248..254] (such as huge-object lookups in
zs_store(), zs_free(), and zs_obj_read_sg_begin()).

Since struct zs_pool allocates from kmalloc-4k at both 2128 and 2112
bytes, this saves no slab memory.  Marking pages_allocated with
____cacheline_aligned_in_smp avoids the false sharing without changing
the kmalloc bucket.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203101411.3609533-1-senozhatsky@chromium.org?part=1


  reply	other threads:[~2026-12-04 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:13 [RFC PATCH 0/4] zsmalloc: replace shrinker with deferred compaction Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 1/4] mm/zsmalloc: remove shrinker Sergey Senozhatsky
2026-12-04 10:14   ` sashiko-bot [this message]
2026-12-03 10:13 ` [RFC PATCH 2/4] zsmalloc: introduce lockless zs_class_can_compact() Sergey Senozhatsky
2026-12-03 10:13 ` [RFC PATCH 3/4] zsmalloc: add deferred threshold compaction Sergey Senozhatsky
2026-12-04 10:14   ` sashiko-bot
2026-12-03 10:13 ` [RFC PATCH 4/4] zram: add compact_threshold sysfs attribute Sergey Senozhatsky
2026-12-04 10:14   ` sashiko-bot
2026-12-04  2:55 ` [RFC PATCH 0/4] zsmalloc: replace shrinker with deferred compaction Xueyuan Chen
2026-12-04  3:49   ` Sergey Senozhatsky
2026-12-04  3:51 ` Sergey Senozhatsky

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=sashiko-outbox-249579@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bgeffon@google.com \
    --cc=chengming.zhou@linux.dev \
    --cc=chriswiseman@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=nzzhao@126.com \
    --cc=richardycc@google.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=senozhatsky@chromium.org \
    --cc=xueyuan.chen21@gmail.com \
    --cc=xueyuan.chen@vivo.com \
    --cc=yosry@kernel.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