Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvm_pageidlezero: grab kernel_lock before uvm.fpageq...
details: https://anonhg.NetBSD.org/src/rev/1ddb19032682
branches: trunk
changeset: 570678:1ddb19032682
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Oct 23 21:29:27 2004 +0000
description:
uvm_pageidlezero: grab kernel_lock before uvm.fpageqlock. PR/27259.
diffstat:
sys/uvm/uvm_page.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diffs (91 lines):
diff -r 5cc91ac6a053 -r 1ddb19032682 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Sat Oct 23 21:27:33 2004 +0000
+++ b/sys/uvm/uvm_page.c Sat Oct 23 21:29:27 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.100 2004/09/17 20:46:03 yamt Exp $ */
+/* $NetBSD: uvm_page.c,v 1.101 2004/10/23 21:29:27 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.100 2004/09/17 20:46:03 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.101 2004/10/23 21:29:27 yamt Exp $");
#include "opt_uvmhist.h"
@@ -1550,32 +1550,29 @@
int free_list, s, firstbucket;
static int nextbucket;
+ KERNEL_LOCK(LK_EXCLUSIVE | LK_CANRECURSE);
s = uvm_lock_fpageq();
firstbucket = nextbucket;
do {
- if (sched_whichqs != 0) {
- uvm_unlock_fpageq(s);
- return;
- }
+ if (sched_whichqs != 0)
+ goto quit;
if (uvmexp.zeropages >= UVM_PAGEZERO_TARGET) {
uvm.page_idle_zero = FALSE;
- uvm_unlock_fpageq(s);
- return;
+ goto quit;
}
for (free_list = 0; free_list < VM_NFREELIST; free_list++) {
pgfl = &uvm.page_free[free_list];
while ((pg = TAILQ_FIRST(&pgfl->pgfl_buckets[
nextbucket].pgfl_queues[PGFL_UNKNOWN])) != NULL) {
- if (sched_whichqs != 0) {
- uvm_unlock_fpageq(s);
- return;
- }
+ if (sched_whichqs != 0)
+ goto quit;
TAILQ_REMOVE(&pgfl->pgfl_buckets[
nextbucket].pgfl_queues[PGFL_UNKNOWN],
pg, pageq);
uvmexp.free--;
uvm_unlock_fpageq(s);
+ KERNEL_UNLOCK();
#ifdef PMAP_PAGEIDLEZERO
if (!PMAP_PAGEIDLEZERO(VM_PAGE_TO_PHYS(pg))) {
@@ -1586,20 +1583,22 @@
* process now ready to run.
*/
+ KERNEL_LOCK(
+ LK_EXCLUSIVE | LK_CANRECURSE);
s = uvm_lock_fpageq();
TAILQ_INSERT_HEAD(&pgfl->pgfl_buckets[
nextbucket].pgfl_queues[
PGFL_UNKNOWN], pg, pageq);
uvmexp.free++;
uvmexp.zeroaborts++;
- uvm_unlock_fpageq(s);
- return;
+ goto quit;
}
#else
pmap_zero_page(VM_PAGE_TO_PHYS(pg));
#endif /* PMAP_PAGEIDLEZERO */
pg->flags |= PG_ZERO;
+ KERNEL_LOCK(LK_EXCLUSIVE | LK_CANRECURSE);
s = uvm_lock_fpageq();
TAILQ_INSERT_HEAD(&pgfl->pgfl_buckets[
nextbucket].pgfl_queues[PGFL_ZEROS],
@@ -1610,5 +1609,7 @@
}
nextbucket = (nextbucket + 1) & uvmexp.colormask;
} while (nextbucket != firstbucket);
+quit:
uvm_unlock_fpageq(s);
+ KERNEL_UNLOCK();
}
Home |
Main Index |
Thread Index |
Old Index