Re: [patch 06/12] rseq: Implement sys_rseq_slice_yield()

K Prateek Nayak
2025-09-10T11:15:20Z

Hello Thomas,

On 9/9/2025 4:30 AM, Thomas Gleixner wrote:
> --- a/kernel/rseq.c
> +++ b/kernel/rseq.c
> @@ -542,6 +542,15 @@ int rseq_slice_extension_prctl(unsigned
> return -EFAULT;
> }
>

nit.

Perhaps a small note here to highlight how need_resched() is true
for tasks who had the slice extension granted. Something like:

/**
* sys_rseq_slice_yield - yield the current processor if a task granted with
* slice extension is done with the critical work before being forced out.
*
* This syscall entry work ensures NEED_RESCHED is set if the task was granted
* a slice extension before arriving here.
*
* Return: 1 if the task successfully yielded the CPU within the granted slice.
* 0 if the slice extension was either never granted or was revoked by
* going over the granted extension.
*/

> +SYSCALL_DEFINE0(rseq_slice_yield)
> +{
> + if (need_resched()) {
> + schedule();
> + return 1;
> + }
> + return 0;
> +}

--
Thanks and Regards,
Prateek