* [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal
@ 2024-07-31 9:50 Liao Chang
2024-07-31 14:12 ` Oleg Nesterov
0 siblings, 1 reply; 4+ messages in thread
From: Liao Chang @ 2024-07-31 9:50 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, mhiramat, oleg
Cc: linux-perf-users, linux-kernel, linux-trace-kernel
Since clearing a bit in thread_info is an atomic operation, the spinlock
is redundant and can be removed, reducing lock contention is good for
performance.
Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
kernel/events/uprobes.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 73cc47708679..76a51a1f51e2 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1979,9 +1979,7 @@ bool uprobe_deny_signal(void)
WARN_ON_ONCE(utask->state != UTASK_SSTEP);
if (task_sigpending(t)) {
- spin_lock_irq(&t->sighand->siglock);
clear_tsk_thread_flag(t, TIF_SIGPENDING);
- spin_unlock_irq(&t->sighand->siglock);
if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) {
utask->state = UTASK_SSTEP_TRAPPED;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal
2024-07-31 9:50 [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal Liao Chang
@ 2024-07-31 14:12 ` Oleg Nesterov
2024-10-22 2:22 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2024-07-31 14:12 UTC (permalink / raw)
To: Liao Chang
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang, mhiramat,
linux-perf-users, linux-kernel, linux-trace-kernel
On 07/31, Liao Chang wrote:
>
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1979,9 +1979,7 @@ bool uprobe_deny_signal(void)
> WARN_ON_ONCE(utask->state != UTASK_SSTEP);
>
> if (task_sigpending(t)) {
> - spin_lock_irq(&t->sighand->siglock);
> clear_tsk_thread_flag(t, TIF_SIGPENDING);
> - spin_unlock_irq(&t->sighand->siglock);
Agreed, in this case ->siglock buys nothing, another signal can come
right after spin_unlock().
Acked-by: Oleg Nesterov <oleg@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal
2024-07-31 14:12 ` Oleg Nesterov
@ 2024-10-22 2:22 ` Masami Hiramatsu
2024-10-22 3:45 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2024-10-22 2:22 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Liao Chang, peterz, mingo, acme, namhyung, mark.rutland,
alexander.shishkin, jolsa, irogers, adrian.hunter, kan.liang,
mhiramat, linux-perf-users, linux-kernel, linux-trace-kernel
On Wed, 31 Jul 2024 16:12:32 +0200
Oleg Nesterov <oleg@redhat.com> wrote:
> On 07/31, Liao Chang wrote:
> >
> > --- a/kernel/events/uprobes.c
> > +++ b/kernel/events/uprobes.c
> > @@ -1979,9 +1979,7 @@ bool uprobe_deny_signal(void)
> > WARN_ON_ONCE(utask->state != UTASK_SSTEP);
> >
> > if (task_sigpending(t)) {
> > - spin_lock_irq(&t->sighand->siglock);
> > clear_tsk_thread_flag(t, TIF_SIGPENDING);
> > - spin_unlock_irq(&t->sighand->siglock);
>
> Agreed, in this case ->siglock buys nothing, another signal can come
> right after spin_unlock().
>
> Acked-by: Oleg Nesterov <oleg@redhat.com>
>
>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Peter, can you pick this?
Thanks,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal
2024-10-22 2:22 ` Masami Hiramatsu
@ 2024-10-22 3:45 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2024-10-22 3:45 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Oleg Nesterov, Liao Chang, peterz, mingo, acme, namhyung,
mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter,
kan.liang, linux-perf-users, linux-kernel, linux-trace-kernel
On Tue, 22 Oct 2024 11:22:22 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Wed, 31 Jul 2024 16:12:32 +0200
> Oleg Nesterov <oleg@redhat.com> wrote:
>
> > On 07/31, Liao Chang wrote:
> > >
> > > --- a/kernel/events/uprobes.c
> > > +++ b/kernel/events/uprobes.c
> > > @@ -1979,9 +1979,7 @@ bool uprobe_deny_signal(void)
> > > WARN_ON_ONCE(utask->state != UTASK_SSTEP);
> > >
> > > if (task_sigpending(t)) {
> > > - spin_lock_irq(&t->sighand->siglock);
> > > clear_tsk_thread_flag(t, TIF_SIGPENDING);
> > > - spin_unlock_irq(&t->sighand->siglock);
> >
> > Agreed, in this case ->siglock buys nothing, another signal can come
> > right after spin_unlock().
> >
> > Acked-by: Oleg Nesterov <oleg@redhat.com>
> >
> >
>
> Looks good to me.
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Peter, can you pick this?
Oops, there is v3.
https://lore.kernel.org/linux-trace-kernel/20240815014629.2685155-2-liaochang1@huawei.com/
>
> Thanks,
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-22 3:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 9:50 [PATCH] uprobes: Remove redundant spinlock in uprobe_deny_signal Liao Chang
2024-07-31 14:12 ` Oleg Nesterov
2024-10-22 2:22 ` Masami Hiramatsu
2024-10-22 3:45 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).