Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 2010 16:40:29 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208264 - in head/sys: kern vm
Message-ID:  <201005181640.o4IGeTrL006763@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue May 18 16:40:29 2010
New Revision: 208264
URL: http://svn.freebsd.org/changeset/base/208264

Log:
  The page queues lock is no longer required by vm_page_set_invalid(), so
  eliminate it.
  
  Assert that the object containing the page is locked in
  vm_page_test_dirty().  Perform some style clean up while I'm here.
  
  Reviewed by:	kib

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/vm/vm_page.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Tue May 18 14:11:38 2010	(r208263)
+++ head/sys/kern/vfs_bio.c	Tue May 18 16:40:29 2010	(r208264)
@@ -1353,9 +1353,7 @@ brelse(struct buf *bp)
 					(PAGE_SIZE - poffset) : resid;
 
 				KASSERT(presid >= 0, ("brelse: extra page"));
-				vm_page_lock_queues();
 				vm_page_set_invalid(m, poffset, presid);
-				vm_page_unlock_queues();
 				if (had_bogus)
 					printf("avoided corruption bug in bogus_page/brelse code\n");
 			}

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Tue May 18 14:11:38 2010	(r208263)
+++ head/sys/vm/vm_page.c	Tue May 18 16:40:29 2010	(r208264)
@@ -2160,10 +2160,13 @@ vm_page_set_invalid(vm_page_t m, int bas
 	int bits;
 
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	KASSERT((m->oflags & VPO_BUSY) == 0,
+	    ("vm_page_set_invalid: page %p is busy", m));
 	bits = vm_page_bits(base, size);
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	if (m->valid == VM_PAGE_BITS_ALL && bits != 0)
 		pmap_remove_all(m);
+	KASSERT(!pmap_page_is_mapped(m),
+	    ("vm_page_set_invalid: page %p is mapped", m));
 	m->valid &= ~bits;
 	m->dirty &= ~bits;
 	m->object->generation++;
@@ -2241,9 +2244,10 @@ vm_page_is_valid(vm_page_t m, int base, 
 void
 vm_page_test_dirty(vm_page_t m)
 {
-	if ((m->dirty != VM_PAGE_BITS_ALL) && pmap_is_modified(m)) {
+
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if (m->dirty != VM_PAGE_BITS_ALL && pmap_is_modified(m))
 		vm_page_dirty(m);
-	}
 }
 
 int so_zerocp_fullpage = 0;



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