From owner-svn-src-stable@FreeBSD.ORG Thu Aug 8 06:07:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DA078DAA; Thu, 8 Aug 2013 06:07:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B886C2811; Thu, 8 Aug 2013 06:07:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7867S0G007425; Thu, 8 Aug 2013 06:07:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7867S7l007423; Thu, 8 Aug 2013 06:07:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308080607.r7867S7l007423@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 8 Aug 2013 06:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r254088 - stable/9/sys/vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2013 06:07:29 -0000 Author: kib Date: Thu Aug 8 06:07:28 2013 New Revision: 254088 URL: http://svnweb.freebsd.org/changeset/base/254088 Log: MFC r253189: Never remove user-wired pages from an object when doing msync(MS_INVALIDATE). The vm_fault_copy_entry() requires that object range which corresponds to the user-wired vm_map_entry, is always fully populated. Add OBJPR_NOTWIRED flag for vm_object_page_remove() to request the preserving behaviour, use it when calling vm_object_page_remove() from vm_object_sync(). Modified: stable/9/sys/vm/vm_object.c stable/9/sys/vm/vm_object.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_object.c ============================================================================== --- stable/9/sys/vm/vm_object.c Thu Aug 8 06:03:34 2013 (r254087) +++ stable/9/sys/vm/vm_object.c Thu Aug 8 06:07:28 2013 (r254088) @@ -1033,9 +1033,9 @@ vm_object_sync(vm_object_t object, vm_oo */ flags = OBJPR_NOTMAPPED; else if (old_msync) - flags = 0; + flags = OBJPR_NOTWIRED; else - flags = OBJPR_CLEANONLY; + flags = OBJPR_CLEANONLY | OBJPR_NOTWIRED; vm_object_page_remove(object, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); } @@ -1866,7 +1866,8 @@ again: vm_page_lock(p); if ((wirings = p->wire_count) != 0 && (wirings = pmap_page_wired_mappings(p)) != p->wire_count) { - if ((options & OBJPR_NOTMAPPED) == 0) { + if ((options & (OBJPR_NOTWIRED | OBJPR_NOTMAPPED)) == + 0) { pmap_remove_all(p); /* Account for removal of wired mappings. */ if (wirings != 0) @@ -1876,8 +1877,7 @@ again: p->valid = 0; vm_page_undirty(p); } - vm_page_unlock(p); - continue; + goto next; } if (vm_page_sleep_if_busy(p, TRUE, "vmopar")) goto again; @@ -1886,12 +1886,12 @@ again: if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_write(p); - if (p->dirty) { - vm_page_unlock(p); - continue; - } + if (p->dirty) + goto next; } if ((options & OBJPR_NOTMAPPED) == 0) { + if ((options & OBJPR_NOTWIRED) != 0 && wirings != 0) + goto next; pmap_remove_all(p); /* Account for removal of wired mappings. */ if (wirings != 0) { @@ -1903,6 +1903,7 @@ again: } } vm_page_free(p); +next: vm_page_unlock(p); } vm_object_pip_wakeup(object); Modified: stable/9/sys/vm/vm_object.h ============================================================================== --- stable/9/sys/vm/vm_object.h Thu Aug 8 06:03:34 2013 (r254087) +++ stable/9/sys/vm/vm_object.h Thu Aug 8 06:07:28 2013 (r254088) @@ -176,6 +176,7 @@ struct vm_object { */ #define OBJPR_CLEANONLY 0x1 /* Don't remove dirty pages. */ #define OBJPR_NOTMAPPED 0x2 /* Don't unmap pages. */ +#define OBJPR_NOTWIRED 0x4 /* Don't remove wired pages. */ TAILQ_HEAD(object_q, vm_object);