Re: [patch V4 08/36] rseq: Avoid CPU/MM CID updates when no event pending

Mathieu Desnoyers
2025-09-09T13:25:55Z

On 2025-09-08 17:31, Thomas Gleixner wrote:
> There is no need to update these values unconditionally if there is no
> event pending.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

>
> ---
> kernel/rseq.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> --- a/kernel/rseq.c
> +++ b/kernel/rseq.c
> @@ -464,11 +464,12 @@ void __rseq_handle_notify_resume(struct
> t->rseq_event_pending = false;
> }
>
> - if (IS_ENABLED(CONFIG_DEBUG_RSEQ) || event) {
> - ret = rseq_ip_fixup(regs, event);
> - if (unlikely(ret < 0))
> - goto error;
> - }
> + if (!IS_ENABLED(CONFIG_DEBUG_RSEQ) && !event)
> + return;
> +
> + ret = rseq_ip_fixup(regs, event);
> + if (unlikely(ret < 0))
> + goto error;
>
> if (unlikely(rseq_update_cpu_node_id(t)))
> goto error;
>
>

--
Mathieu Desnoyers
EfficiOS Inc.