[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_8FD344DA7FC376C7D1204604DA7689DA4906@qq.com>
Date: Tue, 14 Jun 2022 22:03:35 +0800
From: "zhangfei.gao@...mail.com" <zhangfei.gao@...mail.com>
To: Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Shameerali Kolothum Thodi
<shameerali.kolothum.thodi@...wei.com>,
"paulmck@...nel.org" <paulmck@...nel.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Zhangfei Gao <zhangfei.gao@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rcu@...r.kernel.org" <rcu@...r.kernel.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Josh Triplett <josh@...htriplett.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Matthew Wilcox <willy@...radead.org>,
"mtosatti@...hat.com" <mtosatti@...hat.com>,
Auger Eric <eric.auger@...hat.com>,
"chenxiang (M)" <chenxiang66@...ilicon.com>
Subject: Re: Commit 282d8998e997 (srcu: Prevent expedited GPs and blocking
readers from consuming CPU) cause qemu boot slow
On 2022/6/14 下午8:19, Neeraj Upadhyay wrote:
>
>>
>> 5.18-rc4 based ~8sec
>>
>> 5.19-rc1 ~2m43sec
>>
>> 5.19-rc1+fix1 ~19sec
>>
>> 5.19-rc1-fix2 ~19sec
>>
>
> If you try below diff on top of either 5.19-rc1+fix1 or 5.19-rc1-fix2
> ; does it show any difference in boot time?
>
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -706,7 +706,7 @@ static void srcu_schedule_cbs_snp(struct
> srcu_struct *ssp, struct srcu_node *snp
> */
> static void srcu_gp_end(struct srcu_struct *ssp)
> {
> - unsigned long cbdelay;
> + unsigned long cbdelay = 1;
> bool cbs;
> bool last_lvl;
> int cpu;
> @@ -726,7 +726,9 @@ static void srcu_gp_end(struct srcu_struct *ssp)
> spin_lock_irq_rcu_node(ssp);
> idx = rcu_seq_state(ssp->srcu_gp_seq);
> WARN_ON_ONCE(idx != SRCU_STATE_SCAN2);
> - cbdelay = !!srcu_get_delay(ssp);
> + if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq),
> READ_ONCE(ssp->srcu_gp_seq_needed_exp)))
> + cbdelay = 0;
> +
> WRITE_ONCE(ssp->srcu_last_gp_end, ktime_get_mono_fast_ns());
>
Test here:
qemu: https://github.com/qemu/qemu/tree/stable-6.1
kernel:
https://github.com/Linaro/linux-kernel-uadk/tree/uacce-devel-5.19-srcu-test
(in case test patch not clear, push in git tree)
Hardware: aarch64
1. 5.18-rc6
real 0m8.402s
user 0m3.015s
sys 0m1.102s
2. 5.19-rc1
real 2m41.433s
user 0m3.097s
sys 0m1.177s
3. 5.19-rc1 + fix1 from Paul
real 2m43.404s
user 0m2.880s
sys 0m1.214s
4. 5.19-rc1 + fix2: fix1 + Remove "if (!jbase)" block
real 0m15.262s
user 0m3.003s
sys 0m1.033s
When build kernel in the meantime, load time become longer.
5. 5.19-rc1 + fix3: fix1 + SRCU_MAX_NODELAY_PHASE 1000000
real 0m15.215s
user 0m2.942s
sys 0m1.172s
6. 5.19-rc1 + fix4: fix1 + Neeraj's change of srcu_gp_end
real 1m23.936s
user 0m2.969s
sys 0m1.181s
More test details: https://docs.qq.com/doc/DRXdKalFPTVlUbFN5
Thanks
Powered by blists - more mailing lists