From: Neeraj Upadhyay <quic_neeraju@quicinc.com>
To: Marc Zyngier <maz@kernel.org>
Cc: <paulmck@kernel.org>, <frederic@kernel.org>,
<josh@joshtriplett.org>, <rostedt@goodmis.org>,
<mathieu.desnoyers@efficios.com>, <jiangshanlai@gmail.com>,
<joel@joelfernandes.org>, <linux-kernel@vger.kernel.org>,
<zhangfei.gao@foxmail.com>, <boqun.feng@gmail.com>,
<urezki@gmail.com>, <shameerali.kolothum.thodi@huawei.com>,
<pbonzini@redhat.com>, <mtosatti@redhat.com>,
<eric.auger@redhat.com>, <chenxiang66@hisilicon.com>
Subject: Re: [PATCH] srcu: Reduce blocking agressiveness of expedited grace periods further
Date: Tue, 28 Jun 2022 15:32:46 +0530 [thread overview]
Message-ID: <db30cf38-7ee7-30b0-8dff-b2cc504c3588@quicinc.com> (raw)
In-Reply-To: <874k052kxh.wl-maz@kernel.org>
On 6/28/2022 3:01 PM, Marc Zyngier wrote:
> On Tue, 28 Jun 2022 10:17:24 +0100,
> Neeraj Upadhyay <quic_neeraju@quicinc.com> wrote:
>>
>>
>>
>> On 6/28/2022 2:32 PM, Marc Zyngier wrote:
>>> On Mon, 27 Jun 2022 13:37:06 +0100,
>>> Neeraj Upadhyay <quic_neeraju@quicinc.com> wrote:
>>>>
>>>> Commit 640a7d37c3f4 ("srcu: Block less aggressively for expedited
>>>> grace periods") highlights a problem where aggressively blocking
>>>> SRCU expedited grace periods, as was introduced in commit
>>>> 282d8998e997 ("srcu: Prevent expedited GPs and blocking readers
>>>> from consuming CPU"), introduces ~2 minutes delay to the overall
>>>> ~3.5 minutes boot time, when starting VMs with "-bios QEMU_EFI.fd"
>>>> cmdline on qemu, which results in very high rate of memslots
>>>> add/remove, which causes > ~6000 synchronize_srcu() calls for
>>>> kvm->srcu SRCU instance.
>>>>
>>>> Below table captures the experiments done by Zhangfei Gao, Shameer,
>>>> to measure the boottime impact with various values of non-sleeping
>>>> per phase counts, with HZ_250 and preemption enabled:
>>>>
>>>> +──────────────────────────+────────────────+
>>>> | SRCU_MAX_NODELAY_PHASE | Boot time (s) |
>>>> +──────────────────────────+────────────────+
>>>> | 100 | 30.053 |
>>>> | 150 | 25.151 |
>>>> | 200 | 20.704 |
>>>> | 250 | 15.748 |
>>>> | 500 | 11.401 |
>>>> | 1000 | 11.443 |
>>>> | 10000 | 11.258 |
>>>> | 1000000 | 11.154 |
>>>> +──────────────────────────+────────────────+
>>>>
>>>> Analysis on the experiment results showed improved boot time
>>>> with non blocking delays close to one jiffy duration. This
>>>> was also seen when number of per-phase iterations were scaled
>>>> to one jiffy.
>>>>
>>>> So, this change scales per-grace-period phase number of non-sleeping
>>>> polls, soiuch that, non-sleeping polls are done for one jiffy. In addition
>>>> to this, srcu_get_delay() call in srcu_gp_end(), which is used to calculate
>>>> the delay used for scheduling callbacks, is replaced with the check for
>>>> expedited grace period. This is done, to schedule cbs for completed expedited
>>>> grace periods immediately, which results in improved boot time seen in
>>>> experiments.
>>>>
>>>> In addition to the changes to default per phase delays, this change
>>>> adds 3 new kernel parameters - srcutree.srcu_max_nodelay,
>>>> srcutree.srcu_max_nodelay_phase, srcutree.srcu_retry_check_delay.
>>>> This allows users to configure the srcu grace period scanning delays,
>>>> depending on their system configuration requirements.
>>>>
>>>> Signed-off-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
>>>
>>> I've given this a go on one of my test platforms (the one I noticed
>>> the issue on the first place), and found that the initial part of the
>>> EFI boot under KVM (pointlessly wiping the emulated flash) went down
>>> to 1m7s from 3m50s (HZ=250).
>>>
>>> Clearly a massive improvement, but still a far cry from the original
>>> ~40s (yes, this box is utter crap -- which is why I use it).
>>
>> Do you see any improvement by using "srcutree.srcu_max_nodelay=1000"
>> bootarg, on top of this patch?
>
> Yup, this brings it back to 43s on a quick test run, which is close
> enough to what I had before.
>
Cool, thanks!
> How does a random user come up with such a value though?
>
It need to be tuned :) The patch actually adds 2 jiffies (vs the one
jiffy mentioned in the commit log) of non-sleep per phase delay. Each
phase iteration uses a delay of 10 us. So, for CONFIG_HZ_250 its around
800 iterations.
Thanks
Neeraj
> Thanks,
>
> M.
>
next prev parent reply other threads:[~2022-06-28 10:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 12:37 Neeraj Upadhyay
2022-06-27 22:45 ` Paul E. McKenney
2022-06-28 3:15 ` Neeraj Upadhyay
2022-06-28 4:26 ` Paul E. McKenney
2022-06-28 2:14 ` Zhangfei Gao
2022-06-28 3:22 ` Neeraj Upadhyay
2022-06-28 4:03 ` Zhangfei Gao
2022-06-28 4:24 ` Paul E. McKenney
2022-06-28 4:26 ` Neeraj Upadhyay
2022-06-28 9:19 ` Neeraj Upadhyay
2022-06-28 9:02 ` Marc Zyngier
2022-06-28 9:17 ` Neeraj Upadhyay
2022-06-28 9:31 ` Marc Zyngier
2022-06-28 10:02 ` Neeraj Upadhyay [this message]
2022-06-28 13:46 ` Paul E. McKenney
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=db30cf38-7ee7-30b0-8dff-b2cc504c3588@quicinc.com \
--to=quic_neeraju@quicinc.com \
--cc=boqun.feng@gmail.com \
--cc=chenxiang66@hisilicon.com \
--cc=eric.auger@redhat.com \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=maz@kernel.org \
--cc=mtosatti@redhat.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rostedt@goodmis.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=urezki@gmail.com \
--cc=zhangfei.gao@foxmail.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®