Re: An idea for spin_lock_contested()

看板DFBSD_kernel作者時間14年前 (2011/11/10 10:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
:Something like: : --gd->gd_curthread->td_critcount; : for (;;) { : if (spin->counta == 1) : continue; : : ++gd->gd_curthread->td_critcount; : cpu_ccfence(); : if (atomic_swap_int(&spin->counta, 1) == 0) : break; : --gd->gd_curthread->td_critcount; It's doable as long as there are no other spinlocks held and the critical section on entry was not being held. But I don't think we'll get much out of it because we don't spin on spinlocks very much any more. -Matt
文章代碼(AID): #1EkpUndZ (DFBSD_kernel)
文章代碼(AID): #1EkpUndZ (DFBSD_kernel)