[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250714102140.4886afa0@batman.local.home>
Date: Mon, 14 Jul 2025 10:21:40 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org, x86@...nel.org,
Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>, Namhyung Kim
<namhyung@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Andrii
Nakryiko <andrii@...nel.org>, Indu Bhagat <indu.bhagat@...cle.com>, "Jose
E. Marchesi" <jemarch@....org>, Beau Belgrave <beaub@...ux.microsoft.com>,
Jens Remus <jremus@...ux.ibm.com>, Linus Torvalds
<torvalds@...ux-foundation.org>, Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>, Florian Weimer <fweimer@...hat.com>, Sam
James <sam@...too.org>
Subject: Re: [PATCH v13 09/14] unwind deferred: Use SRCU
unwind_deferred_task_work()
On Mon, 14 Jul 2025 15:56:38 +0200
Peter Zijlstra <peterz@...radead.org> wrote:
> Please; something like so:
>
> --- a/include/linux/srcu.h
> +++ b/include/linux/srcu.h
> @@ -524,4 +524,9 @@ DEFINE_LOCK_GUARD_1(srcu, struct srcu_st
> srcu_read_unlock(_T->lock, _T->idx),
> int idx)
>
> +DEFINE_LOCK_GUARD_1(srcu_lite, struct srcu_struct,
> + _T->idx = srcu_read_lock_lite(_T->lock),
> + srcu_read_unlock_lite(_T->lock, _T->idx),
> + int idx)
> +
> #endif
> --- a/kernel/unwind/deferred.c
> +++ b/kernel/unwind/deferred.c
> @@ -165,7 +165,7 @@ static void unwind_deferred_task_work(st
>
> cookie = info->id.id;
>
> - guard(mutex)(&callback_mutex);
> + guard(srcu_lite)(&unwind_srcu);
> list_for_each_entry(work, &callbacks, list) {
> work->func(work, &trace, cookie);
> }
I think I rather have a scoped_guard() here. One thing that bothers me
about the guard() logic is that it could easily start to "leak"
protection. That is, the unwind_srcu is only needed for walking the
list. The reason I chose to open code the protection, is because I
wanted to distinctly denote where the end of the protection was.
-- Steve
Powered by blists - more mailing lists