Why do we have interrupts in spinlock?


(Khasan Khafizov) #1

Do we really turn interrupts off in spinlock_acquire and then turn them on only when release spinlock? Does it mean that there will be no context switches between acquiring and releasing? What for do we do it?

This how the functions look likeL

void spinlock_acquire(struct spinlock *splk)
{
     splraise(IPL_NONE, IPL_HIGH);
     ...
}

void spinlock_release(struct spinlock *splk)
{
     ...
     spllower(IPL_HIGH, IPL_NONE);
}