Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Barry Song <baohua@kernel.org>
Cc: Hongfeng Chen <chenhongfeng0212@gmail.com>,
	 Sergey Senozhatsky <senozhatsky@chromium.org>,
	Hongfeng Chen <hongfengchen@xiaomi.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
	 Yosry Ahmed <yosry@kernel.org>,
	Brian Geffon <bgeffon@google.com>, Jens Axboe <axboe@kernel.dk>,
	 linux-mm@kvack.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] zram: keep the hot statistics per CPU
Date: Sun, 6 Dec 2026 12:44:10 +0900	[thread overview]
Message-ID: <axTZov3HJ7RKrVgv@google.com> (raw)
In-Reply-To: <CAGsJ_4yDdXCprwLa9gv=wWbjUhCnMy1tjYH3mOBx0oHmenjQ-g@mail.gmail.com>

On (26/12/04 12:15), Barry Song wrote:
> On Fri, Dec 4, 2026 at 11:56 AM Hongfeng Chen
> <chenhongfeng0212@gmail.com> wrote:
> >
> > From: Hongfeng Chen <hongfengchen@xiaomi.com>
> >
> > On Mon, Nov 23, 2026 at 02:47:37PM +0900, Sergey Senozhatsky wrote:
> > [..]
> > > +static void zram_stat_add(struct zram *zram, enum zram_pcpu_stat item,
> > > +                       s64 amount)
> > > +{
> > > +     struct zram_pcpu_stats *stats = get_cpu_ptr(zram->pcpu_stats);
> > > +
> > > +     local64_add(amount, &stats->stat[item]);
> > > +     put_cpu_ptr(zram->pcpu_stats);
> > > +}
> >
> > On x86 local64_add() is an add without the LOCK prefix, but on arm64,
> > which has no asm/local.h, it is a full atomic64_add(), and this patch
> > makes munmap() slower there.
> 
> Right. On x86, an RMW operation can be performed in a single
> instruction, which is atomic with respect to the local CPU.
> A LOCK prefix is needed to guarantee atomicity across CPUs
> for ordinary RMW instructions.
> 
> On arm64, we have to rely on atomic instructions or disable
> preemption for CPU-local RMW operations.
> 
> In your case, get_cpu_ptr() already disables preemption, so I
> think it's safe to switch to non-atomic operations on both x86
> and arm64, assuming there are no concurrent accesses from
> interrupt contexts.
> 
> Hi Sergey,
> Could we squash Hongfeng's change into your original patch?

Hi Hongfeng, Barry,
Sure, let me work on this.  Thank you!


  reply	other threads:[~2026-12-06  3:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  5:47 [PATCH v3 0/2] zram: zsmalloc: speed up zspage free path Sergey Senozhatsky
2026-11-23  5:47 ` [PATCH v3 1/2] zsmalloc: free a zspage's pages in one batch Sergey Senozhatsky
2026-11-23  5:47 ` [PATCH v3 2/2] zram: keep the hot statistics per CPU Sergey Senozhatsky
2026-12-04  3:56   ` Hongfeng Chen
2026-12-04  4:15     ` Barry Song
2026-12-06  3:44       ` Sergey Senozhatsky [this message]
2026-12-06  3:55     ` 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=axTZov3HJ7RKrVgv@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=baohua@kernel.org \
    --cc=bgeffon@google.com \
    --cc=chenhongfeng0212@gmail.com \
    --cc=hongfengchen@xiaomi.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.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