From: Qais Yousef <qais.yousef@arm.com>
To: John Stultz <jstultz@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Pavankumar Kondeti <pkondeti@codeaurora.org>,
John Dias <joaodias@google.com>,
Connor O'Brien <connoro@google.com>,
Rick Yiu <rickyiu@google.com>, John Kacur <jkacur@redhat.com>,
Chris Redpath <chris.redpath@arm.com>,
Abhijeet Dharmapurikar <adharmap@quicinc.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
kernel-team@android.com,
Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>,
"J . Avila" <elavila@google.com>
Subject: Re: [RFC PATCH v4 3/3] softirq: defer softirq processing to ksoftirqd if CPU is busy with RT
Date: Mon, 17 Oct 2022 15:44:55 +0100 [thread overview]
Message-ID: <20221017144455.ylmwlgrdoj3tdvbp@wubuntu> (raw)
In-Reply-To: <20221010160917.p2ftu3eezsrbfdfk@wubuntu>
On 10/10/22 17:09, Qais Yousef wrote:
> Hi John
>
> On 10/03/22 23:20, John Stultz wrote:
> > From: Pavankumar Kondeti <pkondeti@codeaurora.org>
> >
> > Defer the softirq processing to ksoftirqd if a RT task is
> > running or queued on the current CPU. This complements the RT
> > task placement algorithm which tries to find a CPU that is not
> > currently busy with softirqs.
> >
> > Currently NET_TX, NET_RX, BLOCK and IRQ_POLL softirqs are only
> > deferred as they can potentially run for long time.
> >
> > Additionally, this patch stubs out ksoftirqd_running() logic,
> > in the CONFIG_RT_SOFTIRQ_OPTIMIZATION case, as deferring
> > potentially long-running softirqs will cause the logic to not
> > process shorter-running softirqs immediately. By stubbing it out
> > the potentially long running softirqs are deferred, but the
> > shorter running ones can still run immediately.
>
> The cover letter didn't make it to my inbox (nor to others AFAICS from lore),
> so replying here.
>
> The series looks good to me. It offers a compromise to avoid an existing
> conflict between RT and softirqs without disrupting much how both inherently
> work. I guess it's up to the maintainers to decide if this direction is
> acceptable or not.
>
> I've seen Thomas had a comment on another softirq series (which attempts to
> throttle them ;-) by the way that is worth looking it:
>
> https://lore.kernel.org/lkml/877d81jc13.ffs@tglx/
>
>
> Meanwhile, I did run a few tests on a test laptop that has 2 core SMT2 i7
> laptop (since I assume you tested on Android)
>
> I set priority to 1 for all of these cyclic tests.
>
> First I ran without applying your patch to fix the affinity problem in
> cyclictest:
>
> I had a 1 hour run of 4 threads - 4 iperf threads and 4 dd threads are
> doing work in the background:
>
> | vanilla | with softirq patches v4 |
> -------------------|-----------------|-------------------------|
> t0 max delay (us) | 6728 | 2096 |
> t1 max delay (us) | 2545 | 1990 |
> t2 max delay (us) | 2282 | 2094 |
> t3 max delay (us) | 6038 | 2162 |
>
> Which shows max latency is improved a lot. Though because I missed applying
> your cyclictest patch, I believe this can be attributed only to patch 3 which
> defers the softirq if there's current task is an RT one.
>
>
> I applied your patch to cyclictest to NOT force affinity when specifying -t
> option.
>
>
>
> Ran cyclictest for 4 hours, -t 3, 3 iperf threads and 3 dd threads running in
> the background:
>
> | vanilla | with softirq patches v4 |
> -------------------|-----------------|-------------------------|
> t0 max delay (us) | 2656 | 2164 |
> t1 max delay (us) | 2773 | 1982 |
> t2 max delay (us) | 2272 | 2278 |
>
> I didn't hit a big max delay on this case. It shows things are better still.
>
>
>
> Ran another cyclictest for 4 hours, -t 4, 4 iperf threads and 4 dd threads in
> the background:
>
> | vanilla | with softirq patches v4 |
> -------------------|-----------------|-------------------------|
> t0 max delay (us) | 4012 | 7074 |
> t1 max delay (us) | 2460 | 9088 |
> t2 max delay (us) | 3755 | 2784 |
> t3 max delay (us) | 4392 | 2295 |
>
> Here the results worryingly show that applying the patches make things much
> worse.
>
> I still have to investigate why. I'll have another run to see if the results
> look different, then try to dig more.
>
> All results are from the cyclictest json dump.
Actually scrap those results. I stupidly forgot to enable the
CONFIG_RT_SOFTIRQ_OPTIMIZATION..
I repeated the 4hours, 4-threads test 3 times:
| vanilla | with softirq patches v4 |
-------------------|--------------------|--------------------------|
| #1 | #2 | #3 | #1 | #2 | #3 |
-------------------|------|------|------|--------|--------|--------|
t0 max delay (us) | 9594*| 2246 | 2317 | 2763 | 2274 | 2623 |
t1 max delay (us) | 3236 | 2356 | 2816 | 2675 | 2962 | 2944 |
t2 max delay (us) | 2271 | 2622 | 2829 | 2274 | 2848 | 2400 |
t3 max delay (us) | 2216 | 6587*| 2724 | 2631 | 2753 | 3034 |
Worst case scenario is reduced to 3034us instead of 9594us.
I repeated the 1 hour 3 threads tests again too:
| vanilla | with softirq patches v4 |
-------------------|--------------------|--------------------------|
| #1 | #2 | #3 | #1 | #2 | #3 |
-------------------|_-----|------|------|--------|--------|--------|
t0 max delay (us) |18059 | 2251 | 2365 | 2684 | 2779 | 2838 |
t1 max delay (us) |16311 | 2261 | 2477 | 2963 | 3020 | 3226 |
t2 max delay (us) | 8887 | 2259 | 2432 | 2904 | 2833 | 3016 |
Worst case scenario is 3226us for softirq compared to 18059 for vanilla 6.0.
This time I paid attention to the average as the best case number for vanilla
kernel is better:
| vanilla | with softirq patches v4 |
-------------------|--------------------|--------------------------|
| #1 | #2 | #3 | #1 | #2 | #3 |
-------------------|------|------|------|--------|--------|--------|
t0 avg delay (us) |31.59 |22.94 |26.50 | 31.81 | 33.57 | 34.90 |
t1 avg delay (us) |16.85 |16.32 |37.16 | 29.05 | 30.51 | 31.65 |
t2 avg delay (us) |25.34 |32.12 |17.40 | 26.76 | 28.28 | 28.56 |
It shows that we largely hover around 30us with the patches compared to 16-26us
being more prevalent for vanilla kernels.
I am not sure I can draw a concrete conclusion from these numbers. It seems
I need to run longer than 4 hours to hit the worst case scenario every run on
the vanilla kernel. There's an indication that the worst case scenario is
harder to hit, and it looks there's a hit on the average delay.
I'm losing access to this system from today. I think I'll wait for more
feedback on this RFC; and do another round of testing for longer periods of
time once there's clearer sense this is indeed the direction we'll be going
for.
HTH.
Cheers
--
Qais Yousef
next prev parent reply other threads:[~2022-10-17 14:45 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 23:20 [RFC PATCH v4 0/3] Softirq -rt Optimizations John Stultz
2022-10-03 23:20 ` [RFC PATCH v4 1/3] softirq: Add generic accessor to percpu softirq_pending data John Stultz
2022-10-03 23:20 ` [RFC PATCH v4 2/3] sched: Avoid placing RT threads on cores handling long softirqs John Stultz
[not found] ` <20221004013611.1822-1-hdanton@sina.com>
2022-10-04 2:29 ` John Stultz
[not found] ` <20221005002149.1876-1-hdanton@sina.com>
2022-10-05 1:13 ` John Stultz
[not found] ` <20221005060155.1571-1-hdanton@sina.com>
2022-10-10 15:42 ` Qais Yousef
[not found] ` <20221011111846.284-1-hdanton@sina.com>
2022-10-12 14:10 ` Qais Yousef
2022-10-17 12:40 ` [PATCH RFC " Alexander Gordeev
2022-10-18 3:42 ` John Stultz
2022-10-18 3:59 ` John Stultz
2022-10-18 5:32 ` John Stultz
2022-10-19 9:11 ` Alexander Gordeev
2022-10-19 22:09 ` John Stultz
2022-10-20 0:15 ` Qais Yousef
2022-10-20 12:47 ` Alexander Gordeev
2022-10-22 18:34 ` Joel Fernandes
2022-10-23 7:45 ` Alexander Gordeev
2022-11-15 7:08 ` John Stultz
2022-11-15 12:55 ` Alexander Gordeev
2022-10-19 11:23 ` Qais Yousef
2022-10-22 18:28 ` [RFC PATCH " Joel Fernandes
2022-11-15 21:36 ` John Stultz
2022-10-03 23:20 ` [RFC PATCH v4 3/3] softirq: defer softirq processing to ksoftirqd if CPU is busy with RT John Stultz
2022-10-04 10:45 ` David Laight
2022-10-04 19:19 ` John Stultz
2022-10-10 16:09 ` Qais Yousef
2022-10-17 14:44 ` Qais Yousef [this message]
2022-10-18 0:04 ` John Stultz
2022-10-19 11:01 ` Qais Yousef
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=20221017144455.ylmwlgrdoj3tdvbp@wubuntu \
--to=qais.yousef@arm.com \
--cc=adharmap@quicinc.com \
--cc=chris.redpath@arm.com \
--cc=connoro@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=elavila@google.com \
--cc=jkacur@redhat.com \
--cc=joaodias@google.com \
--cc=jstultz@google.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pkondeti@codeaurora.org \
--cc=rickyiu@google.com \
--cc=rostedt@goodmis.org \
--cc=satyap@codeaurora.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.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