@ljs @paulmckrcu oh, I *loved* abusing `make -j`....
$ make -j 10 emacs
ALL THE LIGHTS LIGHT UP SOLID-ISH...
gawk --debug # today I learnt too... and awk user for 39 years in September.
@paulmckrcu Happened to me, too. On rereading the RSEQ (restartable sequences)* documentation I find out you can set the RSEQ critical regions dynamically. So you can use it to do a wait-free hazard pointer protect that runs about 3x faster than the lock-free version. No loop w/ conditional branch instruction.
There's a couple of other ways to do wait-free hazard pointers but would require changes to retire logic.
@paulmckrcu Oh, sorry. I forgot to mention this is used w/ an asymmetric memory barriers, so it will always appear to be atomic to the retire thread which will do a membarrier() before polling the hazard pointers.
protect() is just a load and store apart from setting and clearing rseq_cs value for the restartable sequence.
@paulmckrcu Like https://pvk.ca/Blog/2020/07/07/flatter-wait-free-hazard-pointers/ but with RSEQ restartable sequence to give you atomic w.r.t. interrupts memory to memory copy. No special hardware instructions. Just Linux and membarrier.
@paulmckrcu Not that I am aware of. Is membarrier using vCPU preemption to determine if it occurred?
@paulmckrcu No probably not. I'm making unwarranted assumptions. I also don't know if IPI calls trigger RSEQ. I'll just stick with one of the other ways of doing wait-free hazard pointers which just uses standard c++26 and would be totally portable.
@paulmckrcu I was making assumptions about how membarrier was implemented. If it was using RCU it would probably work, not so much for the other implementations.
Anyway, I have a wait-free epoch based reclamation implementation that is easier to work with and has the ability to control reclaim granularity.
@paulmckrcu Yes, very tricky. Apparently I mentioned you could do it with a MVC instruction 20 years ago, https://groups.google.com/g/comp.programming.threads/c/XU6BtGNSkF0/m/AmWXvkGn3DAJ, but I have absolutely no memory of that. So I "reinvented" it a short while back, then convinced myself it wouldn't work, and then came across that other article.