Conversation

Paul E. McKenney

Today I learned that gawk has a "--debug" command-line argument, and has had for more than ten years. In my defense, I using awk for about 30 years prior to that...
2
6
11

@paulmckrcu please don't ask me about my thoughts as to what 'make -j' did for a brief, but not brief enough, period.

1
0
1

@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.

0
0
1

@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.

1
0
0
@jwseigh Nice! But if I may ask, how does this deal with the possibility that a updater on some other thread concurrently changed the pointer that you are trying to protect?
1
0
0

@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.

1
0
1
@jwseigh I thought that membarrier only guaranteed ordering, but perhaps you have a trick that I missed.
1
0
0

@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.

0
0
0