From owner-svn-src-head@FreeBSD.ORG Sun Feb 8 20:00:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 705E2106566B; Sun, 8 Feb 2009 20:00:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E9138FC0C; Sun, 8 Feb 2009 20:00:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n18K0Xku032763; Sun, 8 Feb 2009 20:00:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n18K0XQl032762; Sun, 8 Feb 2009 20:00:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200902082000.n18K0XQl032762@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 8 Feb 2009 20:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188325 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2009 20:00:36 -0000 Author: kib Date: Sun Feb 8 20:00:33 2009 New Revision: 188325 URL: http://svn.freebsd.org/changeset/base/188325 Log: Add the comments to vm_map_simplify_entry() and vmspace_fork(), describing why several calls to vm_deallocate_object() with locked map do not result in the acquisition of the vnode lock after map lock. Suggested and reviewed by: tegge Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Feb 8 19:55:13 2009 (r188324) +++ head/sys/vm/vm_map.c Sun Feb 8 20:00:33 2009 (r188325) @@ -1350,6 +1350,16 @@ vm_map_simplify_entry(vm_map_t map, vm_m entry->offset = prev->offset; if (entry->prev != &map->header) vm_map_entry_resize_free(map, entry->prev); + + /* + * If the backing object is the vnode object, + * vm_object_deallocate() results in a call to + * vrele(). Because the reference to the + * object is not last, vrele() does not lock + * the vnode, and map lock can be kept without + * causing vnode lock to be taken after the + * map lock. + */ if (prev->object.vm_object) vm_object_deallocate(prev->object.vm_object); vm_map_entry_dispose(map, prev); @@ -1371,6 +1381,10 @@ vm_map_simplify_entry(vm_map_t map, vm_m vm_map_entry_unlink(map, next); entry->end = next->end; vm_map_entry_resize_free(map, entry); + + /* + * See comment above. + */ if (next->object.vm_object) vm_object_deallocate(next->object.vm_object); vm_map_entry_dispose(map, next); @@ -2729,6 +2743,12 @@ vmspace_fork(struct vmspace *vm1) /* Transfer the second reference too. */ vm_object_reference( old_entry->object.vm_object); + + /* + * As in vm_map_simplify_entry(), the + * vnode lock may not be acquired in + * this call to vm_object_deallocate(). + */ vm_object_deallocate(object); object = old_entry->object.vm_object; }