All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: sashiko-reviews@lists.linux.dev
Cc: 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>,
	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: Sun, 6 Dec 2026 14:57:11 +0900	[thread overview]
Message-ID: <axT33BKUWq1gJwj-@google.com> (raw)
In-Reply-To: <sashiko-outbox-249579@kernel.org>

On (26/12/04 10:14), sashiko-bot@kernel.org wrote:
> > @@ -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.

Dunno...  had Sashiko supported claims with evidence (benchmarks)
then it probably would have been easier.

size classes 248..254 are probably huge-size classes with one object
per zspage (one physical page per zspage).  Adding/removing such an
object by definition results in immediate ->pages_allocated update.
So I guess that sharing is not bad?  The same task that added/removed
zspage updates ->pages_allocated.


  reply	other threads:[~2026-12-06  5:57 UTC|newest]

Thread overview: 14+ 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
2026-12-06  5:57     ` Sergey Senozhatsky [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-06  6:06     ` Sergey Senozhatsky
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
2026-12-05  8:57   ` Nanzhe Zhao

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=axT33BKUWq1gJwj-@google.com \
    --to=senozhatsky@chromium.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.