summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-07-10 14:54:34 -0400
committerRobert Morris <[email protected]>2019-07-10 14:54:34 -0400
commit4bc900e78bdbff3ba22ccccd26833cf70fd300b1 (patch)
tree43c14444677837a6d36b7a07d2f5ea521d12a106
parente6addf25bb1332f8722ea28f2b431d93984f89e5 (diff)
downloadxv6-labs-4bc900e78bdbff3ba22ccccd26833cf70fd300b1.tar.gz
xv6-labs-4bc900e78bdbff3ba22ccccd26833cf70fd300b1.tar.bz2
xv6-labs-4bc900e78bdbff3ba22ccccd26833cf70fd300b1.zip
nits
-rw-r--r--kernel/proc.c4
-rw-r--r--kernel/spinlock.c4
-rw-r--r--kernel/spinlock.h2
3 files changed, 4 insertions, 6 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index 46ac128..0655783 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -64,8 +64,10 @@ allocpid() {
int pid;
acquire(&pid_lock);
- pid = nextpid++;
+ pid = nextpid;
+ nextpid = nextpid + 1;
release(&pid_lock);
+
return pid;
}
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
index 5a44a46..52bd504 100644
--- a/kernel/spinlock.c
+++ b/kernel/spinlock.c
@@ -18,8 +18,6 @@ initlock(struct spinlock *lk, char *name)
// Acquire the lock.
// Loops (spins) until the lock is acquired.
-// Holding a lock for a long time may cause
-// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
@@ -81,7 +79,7 @@ holding(struct spinlock *lk)
}
// push_off/pop_off are like intr_off()/intr_on() except that they are matched:
-// it takes two pop_off to undo two push_off. Also, if interrupts
+// it takes two pop_off()s to undo two push_off()s. Also, if interrupts
// are initially off, then push_off, pop_off leaves them off.
void
diff --git a/kernel/spinlock.h b/kernel/spinlock.h
index 5f244c9..4392820 100644
--- a/kernel/spinlock.h
+++ b/kernel/spinlock.h
@@ -5,7 +5,5 @@ struct spinlock {
// For debugging:
char *name; // Name of lock.
struct cpu *cpu; // The cpu holding the lock.
- struct cpu *last_release;
- uint64 last_pc;
};