Re: [RFC PATCH v7 1/7] Restartable sequences system call

From: Christoph Lameter
Date: Wed Aug 10 2016 - 16:38:46 EST


On Wed, 10 Aug 2016, Mathieu Desnoyers wrote:

> - preemption of kernel code (for atomicity wrt other threads). This would
> replace preempt_disable()/preempt_enable() critical sections touching
> per-cpu data shared with other threads. We would have to do the event_counter
> increment and ip fixup directly in the sched_out hook when preempting
> kernel code.

What we would need is special handling when returning from a context
switch so that we recognize in what type of code section we are in and
continue execution at the proper retry site. This can be done by putting
code into special sections or other methods that do not require additional
coee.

> - possibly interrupt handlers (for atomicity wrt interrupts). This would
> replace local irq save/restore when touching per-cpu data shared with
> interrupt handlers. We would have to increment the event_counter and
> fixup on the pre-irq kernel frame.

Same thing as before. Test if we are in a section by testing the return
address and then maybe continue elsewhere.

> Those supplementary hooks may add significant overall performance overhead,
> so careful benchmarking would be required to figure out if it's worth it.

We need a design that does not need these hooks. If we check the return
IP address for a special range then we would not need those. Any hooks
would bloat the code in such a way that the implementation would not be
acceptable for the kernel code.