DragonFly BSD
DragonFly kernel List (threaded) for 2011-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: An idea for spin_lock_contested()


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Nov 2011 20:06:53 -0700 (PDT)

: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




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]