From owner-p4-projects Sat Aug 10 0:41:17 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3E2FE37B401; Sat, 10 Aug 2002 00:41:10 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3A1037B400 for ; Sat, 10 Aug 2002 00:41:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91C0343E42 for ; Sat, 10 Aug 2002 00:41:09 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7A7f9JU073876 for ; Sat, 10 Aug 2002 00:41:09 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7A7f9rs073871 for perforce@freebsd.org; Sat, 10 Aug 2002 00:41:09 -0700 (PDT) Date: Sat, 10 Aug 2002 00:41:09 -0700 (PDT) Message-Id: <200208100741.g7A7f9rs073871@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 15775 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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