Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Aug 2002 00:41:09 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 15775 for review
Message-ID:  <200208100741.g7A7f9rs073871@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15775

Change 15775 by peter@peter_overcee on 2002/08/10 00:40:47

	On second thoughts, dont merge these out.  I'd feel happier with
	the assertions in while I'm tinkering with this stuff.

Affected files ...

.. //depot/projects/pmap/sys/vm/vm_pageq.c#9 edit

Differences ...

==== //depot/projects/pmap/sys/vm/vm_pageq.c#9 (text+ko) ====

@@ -24,6 +24,22 @@
 #include <vm/vm_extern.h>
 
 struct vpgqueues vm_page_queues[PQ_COUNT];
+static struct mtx vm_pageq_mtx[PQ_COUNT];
+
+#ifdef INVARIANTS
+static __inline void
+vm_pageq_lockcheck(int queue)
+{
+
+	if (queue >= PQ_FREE && queue < PQ_INACTIVE)
+		mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
+	else
+		mtx_assert(&Giant, MA_OWNED);
+}
+#define LOCKCHECK(queue) vm_pageq_lockcheck(queue)
+#else
+#define LOCKCHECK(queue) do { } while(0)
+#endif
 
 void
 vm_pageq_init(void) 
@@ -76,6 +92,7 @@
 {
 	struct vpgqueues *vpq;
 
+	LOCKCHECK(queue);
 	vpq = &vm_page_queues[queue];
 	m->queue = queue;
 	TAILQ_INSERT_TAIL(&vpq->pl, m, pageq);
@@ -94,6 +111,7 @@
 {
 	vm_page_t m;
 
+	LOCKCHECK(PQ_FREE);
 	++cnt.v_page_count;
 	m = PHYS_TO_VM_PAGE(pa);
 	m->phys_addr = pa;
@@ -118,6 +136,7 @@
 	struct vpgqueues *pq;
 
 	if (queue != PQ_NONE) {
+		LOCKCHECK(queue);
 		pq = &vm_page_queues[queue];
 		m->queue = PQ_NONE;
 		TAILQ_REMOVE(&pq->pl, m, pageq);
@@ -141,6 +160,7 @@
 	struct vpgqueues *pq;
 
 	if (queue != PQ_NONE) {
+		LOCKCHECK(queue);
 		m->queue = PQ_NONE;
 		pq = &vm_page_queues[queue];
 		TAILQ_REMOVE(&pq->pl, m, pageq);
@@ -179,6 +199,7 @@
 	vm_page_t m = NULL;
 	struct vpgqueues *pq;
 
+	LOCKCHECK(basequeue);
 	pq = &vm_page_queues[basequeue];
 	/*
 	 * Note that for the first loop, index+i and index-i wind up at the
@@ -201,6 +222,7 @@
 {
 	vm_page_t m;
 
+	LOCKCHECK(basequeue);
 #if PQ_L2_SIZE > 1
         if (prefer_zero) {
                 m = TAILQ_LAST(&vm_page_queues[basequeue+index].pl, pglist);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208100741.g7A7f9rs073871>