Should we check to see if G is on a P then decide to spin or sleep on mutex lock

81 views
Skip to first unread message

Uday Kiran Jonnala

unread,
Oct 7, 2020, 8:55:45 PM10/7/20
to golang-nuts
Just wondering if we can add additional condition below

https://golang.org/src/runtime/lock_futex.go

func lock2(l *mutex) {
     gp := getg() 52  
...
     // Try for lock, rescheduling.
     for i := 0; i < passive_spin; i++ {  

We may need to improve this by stubbing the ownership information say M id into
lock, that way we can decide to spin or sleep if G is running on M currently.

Just a thought.

Starting now on go runtime...thinking a loud here.

Thanks & Regards,
Uday Kiran

Uday Kiran Jonnala

unread,
Oct 7, 2020, 8:56:52 PM10/7/20
to golang-nuts
I meant "see if G is on an M"
Reply all
Reply to author
Forward
0 new messages