From: Steven Rostedt <rostedt@goodmis.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
kuba@kernel.org, ast@kernel.org, clm@fb.com,
mark.rutland@arm.com, mathieu.desnoyers@efficios.com
Subject: Re: [PATCH resend ftrace] Asynchronous grace period for register_ftrace_direct()
Date: Thu, 2 May 2024 17:31:00 -0400 [thread overview]
Message-ID: <20240502173100.42c8a3f7@gandalf.local.home> (raw)
In-Reply-To: <82ae8a24-f9cf-4730-b0d7-43fb3bca2917@paulmck-laptop>
On Wed, 1 May 2024 20:31:06 -0700
"Paul E. McKenney" <paulmck@kernel.org> wrote:
> On Thu, May 02, 2024 at 11:05:01AM +0900, Masami Hiramatsu wrote:
> > On Wed, 1 May 2024 16:12:37 -0700
> > "Paul E. McKenney" <paulmck@kernel.org> wrote:
> >
> > > Note that the immediate pressure for this patch should be relieved by the
> > > NAPI patch series [1], but this sort of problem could easily arise again.
> > >
> > > When running heavy test workloads with KASAN enabled, RCU Tasks grace
> > > periods can extend for many tens of seconds, significantly slowing
> > > trace registration. Therefore, make the registration-side RCU Tasks
> > > grace period be asynchronous via call_rcu_tasks().
> >
> > Good catch! AFAICS, there is no reason to wait for synchronization
> > when adding a new direct trampoline.
> > This looks good to me.
> >
> > Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Thank you very much! I will apply this on my next rebase.
I can take it.
It's not a bug fix but just an performance improvement, so it can go into
the next merge window.
-- Steve
>
> > Thank you,
> >
> > > [1]
> > > https://lore.kernel.org/all/cover.1710877680.git.yan@cloudflare.com/
> > >
> > > Reported-by: Jakub Kicinski <kuba@kernel.org>
> > > Reported-by: Alexei Starovoitov <ast@kernel.org>
> > > Reported-by: Chris Mason <clm@fb.com>
> > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > > Cc: Steven Rostedt <rostedt@goodmis.org>
> > > Cc: Masami Hiramatsu <mhiramat@kernel.org>
> > > Cc: Mark Rutland <mark.rutland@arm.com>
> > > Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > Cc: <linux-trace-kernel@vger.kernel.org>
> > >
> > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > > index 6c96b30f3d63b..32ea92934268c 100644
> > > --- a/kernel/trace/ftrace.c
> > > +++ b/kernel/trace/ftrace.c
> > > @@ -5365,6 +5365,13 @@ static void
> > > remove_direct_functions_hash(struct ftrace_hash *hash, unsigned long }
> > > }
> > >
> > > +static void register_ftrace_direct_cb(struct rcu_head *rhp)
> > > +{
> > > + struct ftrace_hash *fhp = container_of(rhp, struct
> > > ftrace_hash, rcu); +
> > > + free_ftrace_hash(fhp);
> > > +}
> > > +
> > > /**
> > > * register_ftrace_direct - Call a custom trampoline directly
> > > * for multiple functions registered in @ops
> > > @@ -5463,10 +5470,8 @@ int register_ftrace_direct(struct ftrace_ops
> > > *ops, unsigned long addr) out_unlock:
> > > mutex_unlock(&direct_mutex);
> > >
> > > - if (free_hash && free_hash != EMPTY_HASH) {
> > > - synchronize_rcu_tasks();
> > > - free_ftrace_hash(free_hash);
> > > - }
> > > + if (free_hash && free_hash != EMPTY_HASH)
> > > + call_rcu_tasks(&free_hash->rcu,
> > > register_ftrace_direct_cb);
> > > if (new_hash)
> > > free_ftrace_hash(new_hash);
> >
> >
> > --
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-05-02 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 23:12 [PATCH resend ftrace] Asynchronous grace period for register_ftrace_direct() Paul E. McKenney
2024-05-02 2:05 ` Masami Hiramatsu
2024-05-02 3:31 ` Paul E. McKenney
2024-05-02 21:31 ` Steven Rostedt [this message]
2024-05-02 23:13 ` Paul E. McKenney
2024-05-03 0:04 ` Steven Rostedt
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=20240502173100.42c8a3f7@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=ast@kernel.org \
--cc=clm@fb.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=paulmck@kernel.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