From: Jens Axboe <axboe@kernel.dk>
To: Brian King <brking@linux.vnet.ibm.com>, linux-block@vger.kernel.org
Cc: dm-devel@redhat.com, agk@redhat.com, snitzer@redhat.com
Subject: Re: [dm-devel] [PATCH 1/1] block: Convert hd_struct in_flight from atomic to percpu
Date: Wed, 28 Jun 2017 16:19:11 -0600 [thread overview]
Message-ID: <edc27aaf-f6a6-d49e-b0c5-0474a7efbfc3@kernel.dk> (raw)
In-Reply-To: <29091da5-1076-9aa8-5519-37c713e47e83@linux.vnet.ibm.com>
On 06/28/2017 04:07 PM, Brian King wrote:
> On 06/28/2017 04:59 PM, Jens Axboe wrote:
>> On 06/28/2017 03:54 PM, Jens Axboe wrote:
>>> On 06/28/2017 03:12 PM, Brian King wrote:
>>>> -static inline int part_in_flight(struct hd_struct *part)
>>>> +static inline unsigned long part_in_flight(struct hd_struct *part)
>>>> {
>>>> - return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
>>>> + return part_stat_read(part, in_flight[0]) + part_stat_read(part, in_flight[1]);
>>>
>>> One obvious improvement would be to not do this twice, but only have to
>>> loop once. Instead of making this an array, make it a structure with a
>>> read and write count.
>>>
>>> It still doesn't really fix the issue of someone running on a kernel
>>> with a ton of possible CPUs configured. But it does reduce the overhead
>>> by 50%.
>>
>> Or something as simple as this:
>>
>> #define part_stat_read_double(part, field1, field2) \
>> ({ \
>> typeof((part)->dkstats->field1) res = 0; \
>> unsigned int _cpu; \
>> for_each_possible_cpu(_cpu) { \
>> res += per_cpu_ptr((part)->dkstats, _cpu)->field1; \
>> res += per_cpu_ptr((part)->dkstats, _cpu)->field2; \
>> } \
>> res; \
>> })
>>
>> static inline unsigned long part_in_flight(struct hd_struct *part)
>> {
>> return part_stat_read_double(part, in_flight[0], in_flight[1]);
>> }
>>
>
> I'll give this a try and also see about running some more exhaustive
> runs to see if there are any cases where we go backwards in performance.
>
> I'll also run with partitions and see how that impacts this.
And do something nuts, like setting NR_CPUS to 512 or whatever. What do
distros ship with?
--
Jens Axboe
next prev parent reply other threads:[~2017-06-28 22:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 21:12 [PATCH 1/1] block: Convert hd_struct in_flight from atomic to percpu Brian King
2017-06-28 21:49 ` Jens Axboe
2017-06-28 22:04 ` Brian King
2017-06-29 8:40 ` Ming Lei
2017-06-29 15:58 ` Jens Axboe
2017-06-29 16:00 ` Jens Axboe
2017-06-29 18:42 ` Jens Axboe
2017-06-30 1:20 ` Ming Lei
2017-06-30 2:17 ` Jens Axboe
2017-06-30 13:05 ` [dm-devel] " Brian King
2017-06-30 14:08 ` Jens Axboe
2017-06-30 18:33 ` Brian King
2017-06-30 23:23 ` Ming Lei
2017-06-30 23:26 ` Jens Axboe
2017-07-01 2:18 ` Brian King
2017-07-04 1:20 ` Ming Lei
2017-07-04 20:58 ` Brian King
2017-07-01 4:17 ` Jens Axboe
2017-07-01 4:59 ` Jens Axboe
2017-07-01 16:43 ` Jens Axboe
2017-07-04 20:55 ` Brian King
2017-07-04 21:57 ` Jens Axboe
2017-06-29 16:25 ` Ming Lei
2017-06-29 17:31 ` Brian King
2017-06-30 1:08 ` Ming Lei
2017-06-28 21:54 ` Jens Axboe
2017-06-28 21:59 ` Jens Axboe
2017-06-28 22:07 ` [dm-devel] " Brian King
2017-06-28 22:19 ` Jens Axboe [this message]
2017-06-29 12:59 ` Brian King
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=edc27aaf-f6a6-d49e-b0c5-0474a7efbfc3@kernel.dk \
--to=axboe@kernel.dk \
--cc=agk@redhat.com \
--cc=brking@linux.vnet.ibm.com \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=snitzer@redhat.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