From: "tj@kernel.org" <tj@kernel.org>
To: "Boy Wu (吳勃誼)" <Boy.Wu@mediatek.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"boris@bur.io" <boris@bur.io>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"Iverlin Wang (王苳霖)" <Iverlin.Wang@mediatek.com>,
"josef@toxicpanda.com" <josef@toxicpanda.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v4] blk-cgroup: Replace u64 sync with spinlock for iostat
Date: Tue, 30 Jul 2024 09:49:57 -1000 [thread overview]
Message-ID: <ZqlD5WXx39E8xVnA@slm.duckdns.org> (raw)
In-Reply-To: <e944e61fb64e5094aa6a0afef652359734619ba5.camel@mediatek.com>
Hello, Boy.
On Fri, Jul 26, 2024 at 03:43:27AM +0000, Boy Wu (吳勃誼) wrote:
...
> The use of a spinlock with u64 sync is suggested in
> include/linux/u64_stats_sync.h:33.
>
> * Usage :
> *
> * Stats producer (writer) should use following template granted it
> already got
> * an exclusive access to counters (a lock is already taken, or per cpu
> * data is used [in a non preemptable context])
> *
> * spin_lock_bh(...) or other synchronization to get exclusive access
> * ...
> * u64_stats_update_begin(&stats->syncp);
> * u64_stats_add(&stats->bytes64, len); // non atomic operation
> * u64_stats_inc(&stats->packets64); // non atomic operation
> * u64_stats_update_end(&stats->syncp);
>
> Is this a incorrect statment?
That's not incorrect and it'd make sense if we really want to use u64_sync -
e.g. the reader is hot path. Here, just a spinlock would be simpler and do
fine.
Thanks.
--
tejun
next prev parent reply other threads:[~2024-07-30 19:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 8:41 [PATCH v4] blk-cgroup: Replace u64 sync with spinlock for iostat boy.wu
2024-07-18 21:15 ` Tejun Heo
2024-07-19 1:47 ` Boy Wu (吳勃誼)
2024-07-19 17:31 ` tj
2024-07-26 3:43 ` Boy Wu (吳勃誼)
2024-07-30 19:49 ` tj [this message]
2024-08-09 7:50 ` Boy Wu (吳勃誼)
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=ZqlD5WXx39E8xVnA@slm.duckdns.org \
--to=tj@kernel.org \
--cc=Boy.Wu@mediatek.com \
--cc=Iverlin.Wang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=axboe@kernel.dk \
--cc=boris@bur.io \
--cc=cgroups@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.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