Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Dec 2014 15:02:31 +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: r275513 - head/sys/vm
Message-ID:  <201412051502.sB5F2V7g066261@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Dec  5 15:02:30 2014
New Revision: 275513
URL: https://svnweb.freebsd.org/changeset/base/275513

Log:
  When the last reference on the vnode' vm object is dropped, read the
  vp->v_vflag without taking vnode lock and without bypass.  We do know
  that vp is the lowest level in the stack, since the pointer is
  obtained from the object' handle.  Stale VV_TEXT flag read can only
  happen if parallel execve() is performed and not yet activated the
  image, since process takes reference for text mapping.  In this case,
  the execve() code manages the VV_TEXT flag on its own already.
  
  It was observed that otherwise read-only sendfile(2) requires
  exclusive vnode lock and contending on it on some loads for VV_TEXT
  handling.
  
  Reported by:	glebius, scottl
  Tested by:	glebius, pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Fri Dec  5 13:30:45 2014	(r275512)
+++ head/sys/vm/vm_object.c	Fri Dec  5 15:02:30 2014	(r275513)
@@ -468,7 +468,12 @@ vm_object_vndeallocate(vm_object_t objec
 	}
 #endif
 
-	if (object->ref_count > 1) {
+	/*
+	 * The test for text of vp vnode does not need a bypass to
+	 * reach right VV_TEXT there, since it is obtained from
+	 * object->handle.
+	 */
+	if (object->ref_count > 1 || (vp->v_vflag & VV_TEXT) == 0) {
 		object->ref_count--;
 		VM_OBJECT_WUNLOCK(object);
 		/* vrele may need the vnode lock. */



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