Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 09:52:57 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240741 - head/sys/vm
Message-ID:  <201209200952.q8K9qvDX092283@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Sep 20 09:52:57 2012
New Revision: 240741
URL: http://svn.freebsd.org/changeset/base/240741

Log:
  Plug the accounting leak for the wired pages when msync(MS_INVALIDATE)
  is performed on the vnode mapping which is wired in other address space.
  
  While there, explicitely assert that the page is unwired and zero the
  wire_count instead of substract. The condition is rechecked later in
  vm_page_free(_toq) already.
  
  Reported and tested by:	zont
  Reviewed by:	alc (previous version)
  MFC after:	1 week

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Thu Sep 20 08:50:39 2012	(r240740)
+++ head/sys/vm/vm_object.c	Thu Sep 20 09:52:57 2012	(r240741)
@@ -1918,8 +1918,13 @@ again:
 		if ((options & OBJPR_NOTMAPPED) == 0) {
 			pmap_remove_all(p);
 			/* Account for removal of wired mappings. */
-			if (wirings != 0)
-				p->wire_count -= wirings;
+			if (wirings != 0) {
+				KASSERT(p->wire_count == wirings,
+				    ("inconsistent wire count %d %d %p",
+				    p->wire_count, wirings, p));
+				p->wire_count = 0;
+				atomic_subtract_int(&cnt.v_wire_count, 1);
+			}
 		}
 		vm_page_free(p);
 		vm_page_unlock(p);



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