From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 2/4] block/part_stat: use __this_cpu_add() instead of access by smp_processor_id()
Date: Mon, 04 May 2020 16:29:32 +0300 [thread overview]
Message-ID: <158859897252.19836.5614675872684760741.stgit@buzz> (raw)
In-Reply-To: <158859896942.19836.15240144203131230746.stgit@buzz>
Most architectures have fast path to access percpu for current cpu.
Required preempt_disable() is provided by part_stat_lock().
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
include/linux/part_stat.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h
index 755a01f0fd61..a0ddeff3798e 100644
--- a/include/linux/part_stat.h
+++ b/include/linux/part_stat.h
@@ -36,6 +36,9 @@
res; \
})
+#define __part_stat_add(part, field, addnd) \
+ __this_cpu_add((part)->dkstats->field, addnd)
+
static inline void part_stat_set_all(struct hd_struct *part, int value)
{
int i;
@@ -64,6 +67,9 @@ static inline void free_part_stats(struct hd_struct *part)
#define part_stat_get_cpu(part, field, cpu) part_stat_get(part, field)
#define part_stat_read(part, field) part_stat_get(part, field)
+#define __part_stat_add(part, field, addnd) \
+ (part_stat_get(part, field) += (addnd))
+
static inline void part_stat_set_all(struct hd_struct *part, int value)
{
memset(&part->dkstats, value, sizeof(struct disk_stats));
@@ -85,9 +91,6 @@ static inline void free_part_stats(struct hd_struct *part)
part_stat_read(part, field[STAT_WRITE]) + \
part_stat_read(part, field[STAT_DISCARD]))
-#define __part_stat_add(part, field, addnd) \
- (part_stat_get(part, field) += (addnd))
-
#define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \
if ((part)->partno) \
next prev parent reply other threads:[~2020-05-04 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 13:29 [PATCH 1/4] block/part_stat: remove rcu_read_lock() from part_stat_lock() Konstantin Khlebnikov
2020-05-04 13:29 ` Konstantin Khlebnikov [this message]
2020-05-04 14:03 ` [PATCH 2/4] block/part_stat: use __this_cpu_add() instead of access by smp_processor_id() Christoph Hellwig
2020-05-04 15:02 ` Konstantin Khlebnikov
2020-05-04 15:10 ` Christoph Hellwig
2020-05-04 13:30 ` [PATCH 3/4] block/part_stat: account merge of two requests Konstantin Khlebnikov
2020-05-04 14:03 ` Christoph Hellwig
2020-05-04 13:31 ` [PATCH 4/4] block/part_stat: add helper blk_account_io_merge_bio() Konstantin Khlebnikov
2020-05-04 14:06 ` Christoph Hellwig
2020-05-04 14:00 ` [PATCH 1/4] block/part_stat: remove rcu_read_lock() from part_stat_lock() Christoph Hellwig
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=158859897252.19836.5614675872684760741.stgit@buzz \
--to=khlebnikov@yandex-team.ru \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.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