On Thu, 26 Oct 2023 12:59:44 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
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.
Peter, this is the user space side, where I cut and pasted the code from
the file I attached.
That has:
static inline unsigned long
xchg(volatile unsigned *ptr, unsigned new)
{
unsigned ret = new;
asm volatile("xchg %b0,%1"
: "+r"(ret), "+m"(*(ptr))
: : "memory");
return ret;
}
-- Steve
if (prev & 2) {
tracefs_printf(NULL, "Yield!\n");
sched_yield();
}
}