Re: [patch 07/12] rseq: Implement syscall entry work for time slice extensions

K Prateek Nayak
2025-09-10T05:23:12Z

Hello Thomas,

On 9/9/2025 4:30 AM, Thomas Gleixner wrote:
> +static inline void rseq_slice_set_need_resched(struct task_struct *curr)
> +{
> + /*
> + * The interrupt guard is required to prevent inconsistent state in
> + * this case:
> + *
> + * set_tsk_need_resched()
> + * --> Interrupt
> + * wakeup()
> + * set_tsk_need_resched()
> + * set_preempt_need_resched()
> + * schedule_on_return()
> + * clear_tsk_need_resched()
> + * clear_preempt_need_resched()
> + * set_preempt_need_resched() <- Inconsistent state
> + *
> + * This is safe vs. a remote set of TIF_NEED_RESCHED because that
> + * only sets the already set bit and does not create inconsistent
> + * state.
> + */
> + scoped_guard(irq)
> + set_need_resched_current();

nit. any specific reason for using a scoped_guard() instead of just a
guard() here (and in rseq_cancel_slice_extension_timer()) other than to
prominently highlight what is being guarded?

> +}

--
Thanks and Regards,
Prateek