diff options
author | Frans Kaashoek <[email protected]> | 2020-08-10 13:05:17 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-10 13:05:17 -0400 |
commit | c31d35d8031c88b7e1ea8657cc9806dfdd4c3ef9 (patch) | |
tree | a6c903e1c61c08f4cb87700c320752a737081dcb /kernel/bio.c | |
parent | 90eb90b5e203299427c3fde8c996a48835fc93cf (diff) | |
parent | d8fe1773b26758c7c7b8f36724cd822555b33612 (diff) | |
download | xv6-labs-c31d35d8031c88b7e1ea8657cc9806dfdd4c3ef9.tar.gz xv6-labs-c31d35d8031c88b7e1ea8657cc9806dfdd4c3ef9.tar.bz2 xv6-labs-c31d35d8031c88b7e1ea8657cc9806dfdd4c3ef9.zip |
Merge branch 'riscv' into riscv
Diffstat (limited to 'kernel/bio.c')
-rw-r--r-- | kernel/bio.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/bio.c b/kernel/bio.c index a1074f2..60d91a6 100644 --- a/kernel/bio.c +++ b/kernel/bio.c @@ -28,7 +28,8 @@ struct { struct buf buf[NBUF]; // Linked list of all buffers, through prev/next. - // head.next is most recently used. + // Sorted by how recently the buffer was used. + // head.next is most recent, head.prev is least. struct buf head; } bcache; @@ -71,7 +72,8 @@ bget(uint dev, uint blockno) } } - // Not cached; recycle an unused buffer. + // Not cached. + // Recycle the least recently used (LRU) unused buffer. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ if(b->refcnt == 0) { b->dev = dev; @@ -110,7 +112,7 @@ bwrite(struct buf *b) } // Release a locked buffer. -// Move to the head of the MRU list. +// Move to the head of the most-recently-used list. void brelse(struct buf *b) { |