From: "Paul E. McKenney" <paulmck@kernel.org>
To: Alexei Starovoitov <ast@fb.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: slow sync rcu_tasks_trace
Date: Thu, 10 Sep 2020 13:24:03 -0700 [thread overview]
Message-ID: <20200910202403.GT29330@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <e6d7e0c9-1ca0-ec28-c306-b3c474e83daf@fb.com>
On Thu, Sep 10, 2020 at 12:04:32PM -0700, Alexei Starovoitov wrote:
> On 9/10/20 11:51 AM, Paul E. McKenney wrote:
> > On Thu, Sep 10, 2020 at 11:33:58AM -0700, Alexei Starovoitov wrote:
> > > On 9/9/20 10:27 PM, Paul E. McKenney wrote:
> > > > On Wed, Sep 09, 2020 at 02:22:12PM -0700, Paul E. McKenney wrote:
> > > > > On Wed, Sep 09, 2020 at 02:04:47PM -0700, Paul E. McKenney wrote:
> > > > > > On Wed, Sep 09, 2020 at 12:48:28PM -0700, Alexei Starovoitov wrote:
> > > > > > > On Wed, Sep 09, 2020 at 12:39:00PM -0700, Paul E. McKenney wrote:
> > > >
> > > > [ . . . ]
> > > >
> > > > > > > > My plan is to try the following:
> > > > > > > >
> > > > > > > > 1. Parameterize the backoff sequence so that RCU Tasks Trace
> > > > > > > > uses faster rechecking than does RCU Tasks. Experiment as
> > > > > > > > needed to arrive at a good backoff value.
> > > > > > > >
> > > > > > > > 2. If the tasks-list scan turns out to be a tighter bottleneck
> > > > > > > > than the backoff waits, look into parallelizing this scan.
> > > > > > > > (This seems unlikely, but the fact remains that RCU Tasks
> > > > > > > > Trace must do a bit more work per task than RCU Tasks.)
> > > > > > > >
> > > > > > > > 3. If these two approaches, still don't get the update-side
> > > > > > > > latency where it needs to be, improvise.
> > > > > > > >
> > > > > > > > The exact path into mainline will of course depend on how far down this
> > > > > > > > list I must go, but first to get a solution.
> > > > > > >
> > > > > > > I think there is a case of 4. Nothing is inside rcu_trace critical section.
> > > > > > > I would expect single ipi would confirm that.
> > > > > >
> > > > > > Unless the task moves, yes. So a single IPI should suffice in the
> > > > > > common case.
> > > > >
> > > > > And what I am doing now is checking code paths.
> > > >
> > > > And the following diff from a set of three patches gets my average
> > > > RCU Tasks Trace grace-period latencies down to about 20 milliseconds,
> > > > almost a 50x improvement from earlier today.
> > > >
> > > > These are still quite rough and not yet suited for production use, but
> > > > I will be testing. If that goes well, I hope to send a more polished
> > > > set of patches by end of day tomorrow, Pacific Time. But if you get a
> > > > chance to test them, I would value any feedback that you might have.
> > > >
> > > > These patches do not require hand-tuning, they instead adjust the
> > > > behavior according to CONFIG_TASKS_TRACE_RCU_READ_MB, which in turn
> > > > adjusts according to CONFIG_PREEMPT_RT. So you should get the desired
> > > > latency reductions "out of the box", again, without tuning.
> > >
> > > Great. Confirming improvement :)
> > >
> > > time ./test_progs -t trampoline_count
> > > #101 trampoline_count:OK
> > > Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
> > >
> > > real 0m2.897s
> > > user 0m0.128s
> > > sys 0m1.527s
> > >
> > > This is without CONFIG_TASKS_TRACE_RCU_READ_MB, of course.
> >
> > Good to hear, thank you!
> >
> > or is more required? I can tweak to get more. There is never a free
> > lunch, though, and in this case the downside of further tweaking would
> > be greater CPU overhead. Alternatively, I could just as easily tweak
> > it to be slower, thereby reducing the CPU overhead.
> >
> > If I don't hear otherwise, I will assume that the current settings
> > work fine.
>
> Now it looks like that sync rcu_tasks_trace is not slower than rcu_tasks, so
> if it would only makes sense to accelerate both at the same time.
> I think for now it's good.
Music to my ears!
I have sent the official RFC patch series, CCing the people active on this
thread and also the BPF email list, as well as the usual RCU suspects.
Anyone else I should solicit testing/review from?
> > Of course, if people start removing thousands of BPF programs at one go,
> > I suspect that it will be necessary to provide a bulk-removal operation,
> > similar to some of the bulk-configuration-change operations provided by
> > networking. The idea is to have a single RCU Tasks Trace grace period
> > cover all of the thousands of BPF removal operations.
>
> bulk api won't really work for user space.
> There is no good way to coordinate attaching different progs (or the same
> prog) to many different places.
Fair enough for now, especially unless and until it becomes a problem.
Thanx, Paul
prev parent reply other threads:[~2020-09-10 20:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 2:34 slow sync rcu_tasks_trace Alexei Starovoitov
2020-09-09 11:38 ` Paul E. McKenney
2020-09-09 15:10 ` Jiri Olsa
2020-09-09 17:02 ` Paul E. McKenney
2020-09-09 17:12 ` Alexei Starovoitov
2020-09-09 17:35 ` Paul E. McKenney
2020-09-09 18:04 ` Alexei Starovoitov
2020-09-09 19:39 ` Paul E. McKenney
2020-09-09 19:48 ` Alexei Starovoitov
2020-09-09 21:04 ` Paul E. McKenney
2020-09-09 21:22 ` Paul E. McKenney
2020-09-10 5:27 ` Paul E. McKenney
2020-09-10 18:33 ` Alexei Starovoitov
2020-09-10 18:51 ` Paul E. McKenney
2020-09-10 19:04 ` Alexei Starovoitov
2020-09-10 20:24 ` Paul E. McKenney [this message]
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=20200910202403.GT29330@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=Kernel-team@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
/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