From 8e1d1ec934d5ebcd4d8208f88857be12c8a97a06 Mon Sep 17 00:00:00 2001 From: kaashoek <kaashoek> Date: Fri, 8 Sep 2006 14:36:44 +0000 Subject: some comment changes --- spinlock.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'spinlock.c') diff --git a/spinlock.c b/spinlock.c index 2e604b7..f814632 100644 --- a/spinlock.c +++ b/spinlock.c @@ -51,10 +51,9 @@ acquire(struct spinlock *lock) while(cmpxchg(0, 1, &lock->locked) == 1) ; - // Now that lock is acquired, make sure - // we wait for all pending writes from other - // processors. - cpuid(0, 0, 0, 0, 0); // memory barrier + // Serialize instructions: now that lock is acquired, make sure + // we wait for all pending writes from other processors. + cpuid(0, 0, 0, 0, 0); // memory barrier (see Ch 7 of IA-32 manual, vol 3) // Record info about lock acquisition for debugging. // The +10 is only so that we can tell the difference @@ -74,9 +73,9 @@ release(struct spinlock *lock) lock->pcs[0] = 0; lock->cpu = 0xffffffff; - // Before unlocking the lock, make sure to flush - // any pending memory writes from this processor. - cpuid(0, 0, 0, 0, 0); // memory barrier + // Serialize instructions: before unlocking the lock, make sure + // to flush any pending memory writes from this processor. + cpuid(0, 0, 0, 0, 0); // memory barrier (see Ch 7 of IA-32 manual, vol 3) lock->locked = 0; if(--cpus[cpu()].nlock == 0) -- cgit v1.2.3