[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8323816F-8481-4DBA-B074-19A0CAFE3C30@didiglobal.com>
Date: Wed, 8 May 2024 02:56:54 +0000
From: 付元力 Jerry Fu <fuyuanli@...iglobal.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>, "mingo@...hat.com"
<mingo@...hat.com>, "peterz@...radead.org" <peterz@...radead.org>,
"juri.lelli@...hat.com" <juri.lelli@...hat.com>, "vincent.guittot@...aro.org"
<vincent.guittot@...aro.org>, "dietmar.eggemann@....com"
<dietmar.eggemann@....com>, "rostedt@...dmis.org" <rostedt@...dmis.org>,
"bsegall@...gle.com" <bsegall@...gle.com>, "mgorman@...e.de"
<mgorman@...e.de>, "bristot@...hat.com" <bristot@...hat.com>,
"vschneid@...hat.com" <vschneid@...hat.com>, "kolyshkin@...il.com"
<kolyshkin@...il.com>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "kent.overstreet@...ux.dev"
<kent.overstreet@...ux.dev>, "frederic@...nel.org" <frederic@...nel.org>,
"oleg@...hat.com" <oleg@...hat.com>, "hca@...ux.ibm.com" <hca@...ux.ibm.com>,
"paulmck@...nel.org" <paulmck@...nel.org>, "tj@...nel.org" <tj@...nel.org>,
"kuba@...nel.org" <kuba@...nel.org>, "CruzZhao@...ux.alibaba.com"
<CruzZhao@...ux.alibaba.com>, "pabeni@...hat.com" <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched: Introduce task_struct::latency_sensi_flag.
>
>
>
> 在 2024/5/7 上午9:28,“Sebastian Andrzej Siewior”<bigeasy@...utronix.de <mailto:bigeasy@...utronix.de>> 写入:
>
>
> On 2024-05-05 11:06:15 [+0800], fuyuanli wrote:
> > In the path local_bh_enable()->__local_bh_enable_ip(), the softirq
> > handlers will be executed in the context of current task. But for some
> > tasks sensitive to running latency, we expect that they will not spend
> > extra time executing softirq. So latency_sensi_flag is introduced in
> > task_struct, when it is set to 1, task only wakes up softirq daemon in
> > __local_bh_enable_ip().
> >
> > A test has been made in two hosts named A and B. In A, several clients
> > sent udp packets to a single server in B concurrently as fast as
> > possible. In B, the IRQs of these flows were bound to CPU 0 by flow
> > director, so there was always a triggered net_rx softirq on CPU 0. Then
> > a test program was started in B, which was also bound to CPU 0, and
> > keeped calling sendto() in a loop. Sampling with perf, results showed
> > that about 25% of running time of test program was spent executing
> > local_bh_enable() contained in syscall sendto(), but after setting
> > latency_sensi_flag to 1, this proportion had been reduced to 0.5%.
>
>
> Is this PREEMPT_RT related or not?
The problem that I met occured on RT kernel, a task had high latency
due to spend
much time doing softirq. And I think some tasks on Non-RT kernel may
also want low
latency, so introduce this flag to both RT and Non-RT kernel.
> RT wise I worked hard to get rid of ksoftirqd usage because you use lose
My implementation refers to current code in RT kernel. In current
version, __local_bh_enable_ip()
will outsource work to ksoftirqd when preempt is disabled.
> context, priority and everything once this happens. Plus an innocent
> thread can be forced to do the work instead.
Sorry, I don't understand, which thread you mean?
> Non-RT wise your performance can go rapidly down the hill if the wrong
> task/ user is outsourcing the work to ksoftirqd.
I agree, so the default value of new flag is 0, which does not affect
normal working of softirq.
Users need to evaluate both performance and latency impacts, and
decide if set it to 1
>
>
> And this is what you are doing: You are outsourcing work to a different
> context and have 25% improvement here and 25% work somewhere else which
Yeah, there must be 25% work somewhere else. I think the purpose of
outsourcing work is to
ensure some special tasks have low latency, not whole system. And the
decision lies with users.
> you don't measure. Not to mention that _another_ context could do this
> softirq work if it happens to end up in the section before ksoftirqd had
> a chance to run.
>
>
> So, this does not sound good. If you want to have a low-latency task
> which can send packets and not do the needed softirq part I would
> suggest to have another thread where this is outsourced and the thread
> does the work.
What you mean is napi thread? My thought is providing a way to have a
low-latency task if user does
not want to enable napi threaded,
>
>
> > Signed-off-by: fuyuanli <fuyuanli@...iglobal.com <mailto:fuyuanli@...iglobal.com>>
>
>
> Sebastian
>
>
>
Thanks
fuyuanli
在 2024/5/7 上午9:28,“Sebastian Andrzej Siewior”<bigeasy@...utronix.de <mailto:bigeasy@...utronix.de>> 写入:
On 2024-05-05 11:06:15 [+0800], fuyuanli wrote:
> In the path local_bh_enable()->__local_bh_enable_ip(), the softirq
> handlers will be executed in the context of current task. But for some
> tasks sensitive to running latency, we expect that they will not spend
> extra time executing softirq. So latency_sensi_flag is introduced in
> task_struct, when it is set to 1, task only wakes up softirq daemon in
> __local_bh_enable_ip().
>
> A test has been made in two hosts named A and B. In A, several clients
> sent udp packets to a single server in B concurrently as fast as
> possible. In B, the IRQs of these flows were bound to CPU 0 by flow
> director, so there was always a triggered net_rx softirq on CPU 0. Then
> a test program was started in B, which was also bound to CPU 0, and
> keeped calling sendto() in a loop. Sampling with perf, results showed
> that about 25% of running time of test program was spent executing
> local_bh_enable() contained in syscall sendto(), but after setting
> latency_sensi_flag to 1, this proportion had been reduced to 0.5%.
Is this PREEMPT_RT related or not?
RT wise I worked hard to get rid of ksoftirqd usage because you use lose
context, priority and everything once this happens. Plus an innocent
thread can be forced to do the work instead.
Non-RT wise your performance can go rapidly down the hill if the wrong
task/ user is outsourcing the work to ksoftirqd.
And this is what you are doing: You are outsourcing work to a different
context and have 25% improvement here and 25% work somewhere else which
you don't measure. Not to mention that _another_ context could do this
softirq work if it happens to end up in the section before ksoftirqd had
a chance to run.
So, this does not sound good. If you want to have a low-latency task
which can send packets and not do the needed softirq part I would
suggest to have another thread where this is outsourced and the thread
does the work.
> Signed-off-by: fuyuanli <fuyuanli@...iglobal.com <mailto:fuyuanli@...iglobal.com>>
Sebastian
Powered by blists - more mailing lists