mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiebin Sun <jiebin.sun@intel.com>
To: akpm@linux-foundation.org, bigeasy@linutronix.de
Cc: dennis@kernel.org, tj@kernel.org, cl@gentwo.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	clrkwllms@kernel.org, rostedt@goodmis.org,
	linux-rt-devel@lists.linux.dev, tim.c.chen@linux.intel.com,
	tianyou.li@intel.com, wangyang.guo@intel.com,
	jiebin.sun@intel.com
Subject: Re: [PATCH] lib/percpu_counter: allow concurrent sums with an rwlock
Date: Wed, 18 Nov 2026 18:16:46 +0800	[thread overview]
Message-ID: <20261118101646.3192636-1-jiebin.sun@intel.com> (raw)
In-Reply-To: <20261115191636.f18859e4dd5f58b9a33e7814@linux-foundation.org>

Hi Andrew and Sebastian,

Thanks for the comments and the RT review.

I'll replace the macros with static inline helpers, add the RT comment,
and clarify the practical callers, including percpu_counter_sum_positive(),
in v2.

Interrupt readers can bypass a WAITING writer and delay it if they keep
overlapping. I'm considering the impact this could have on counter
updates. If this needs addressing, we might take the write lock in
__percpu_counter_sum() when called from interrupt context, while keeping
the read lock for ordinary sums.

I also tested buffered writes with fio.

Fio (64 jobs, 3 iterations, 60s each):

  +------+------------+-----------------+---------+
  | Test | Throughput | CPU utilization | Cycles  |
  +------+------------+-----------------+---------+
  | Fio  |     +6.91% |         -40.41% | -40.80% |
  +------+------------+-----------------+---------+

Test configuration: ext4, 32 GiB cgroup memory limit.

Commands:

  sysctl -w vm.dirty_bytes=67108864 \
             vm.dirty_background_bytes=33554432

  fio --name=buffered-write --directory="$TEST_DIR" \
      --ioengine=sync --rw=write --bs=64k --size=256m --numjobs=64 \
      --direct=0 --fallocate=none --time_based=1 --runtime=60 \
      --cpus_allowed=0-31,86-117 --cpus_allowed_policy=split \
      --group_reporting --output-format=json

Thanks,
Jiebin

  parent reply	other threads:[~2026-11-18 10:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  1:56 Jiebin Sun
2026-11-16  3:16 ` Andrew Morton
2026-11-16  3:44   ` Andrew Morton
2026-11-16  7:41     ` Sebastian Andrzej Siewior
2026-11-18 10:16   ` Jiebin Sun [this message]
2026-11-16  7:30 ` Sebastian Andrzej Siewior

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=20261118101646.3192636-1-jiebin.sun@intel.com \
    --to=jiebin.sun@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=cl@gentwo.org \
    --cc=clrkwllms@kernel.org \
    --cc=dennis@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=tianyou.li@intel.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=wangyang.guo@intel.com \
    /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

all inboxes | Powered by JetHome®