Re: [POC][RFC][PATCH v2] sched: Extended Scheduler Time Slice

From: Peter Zijlstra
Date: Thu Oct 26 2023 - 07:00:49 EST


On Wed, Oct 25, 2023 at 11:54:13PM -0400, Steven Rostedt wrote:

> static void extend(void)
> {
> rseq_map.cr_flags = 1;
> }
>
> static void unextend(void)
> {
> unsigned long prev;
>
> prev = xchg(&rseq_map.cr_flags, 0);

So you complain about overhead and then you add one of the most
expensive ops possible here? xchg has an implicit LOCK prefix and you
really don't need LOCK prefix here.

> if (prev & 2) {
> tracefs_printf(NULL, "Yield!\n");
> sched_yield();
> }
> }