From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com, kolyshkin@gmail.com,
fuyuanli@didiglobal.com, akpm@linux-foundation.org,
kent.overstreet@linux.dev, frederic@kernel.org, oleg@redhat.com,
hca@linux.ibm.com, paulmck@kernel.org, tj@kernel.org,
kuba@kernel.org, CruzZhao@linux.alibaba.com, pabeni@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: Introduce task_struct::latency_sensi_flag.
Date: Mon, 6 May 2024 11:50:06 +0200 [thread overview]
Message-ID: <20240506095006.W6mrPsML@linutronix.de> (raw)
In-Reply-To: <20240505030615.GA5131@didi-ThinkCentre-M920t-N000>
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@didiglobal.com>
Sebastian
next prev parent reply other threads:[~2024-05-06 9:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-05 3:06 [PATCH] sched: Introduce task_struct::latency_sensi_flag fuyuanli
2024-05-06 9:50 ` Sebastian Andrzej Siewior [this message]
2024-05-08 2:56 ` 付元力 Jerry Fu
2024-05-06 14:04 ` Jakub Kicinski
2024-05-08 3:02 ` 付元力 Jerry Fu
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=20240506095006.W6mrPsML@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=CruzZhao@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=fuyuanli@didiglobal.com \
--cc=hca@linux.ibm.com \
--cc=juri.lelli@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=kolyshkin@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=pabeni@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.