Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2012 18:34:11 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237451 - head/sys/vm
Message-ID:  <201206221834.q5MIYBMn093749@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Jun 22 18:34:11 2012
New Revision: 237451
URL: http://svn.freebsd.org/changeset/base/237451

Log:
  - Add a comment explaining the locking of the cached pages pool held
    by vm_objects.
  - Add flags for the per-object lock and free pages queue mutex lock.
    Use the newly added flags to mark the cache root within the vm_object
    structure.
  
  Please note that other vm_object members should be marked with correct
  locking but they are left for other commits.
  
  In collabouration with:	alc
  
  MFC after:	3 days3 days3 days

Modified:
  head/sys/vm/vm_object.h

Modified: head/sys/vm/vm_object.h
==============================================================================
--- head/sys/vm/vm_object.h	Fri Jun 22 18:20:26 2012	(r237450)
+++ head/sys/vm/vm_object.h	Fri Jun 22 18:34:11 2012	(r237451)
@@ -76,8 +76,21 @@
  *
  *	vm_object_t		Virtual memory object.
  *
+ *	The root of cached pages pool is protected by both the per-object mutex
+ *	and the free pages queue mutex.
+ *	On insert in the cache splay tree, the per-object mutex is expected
+ *	to be already held and the free pages queue mutex will be
+ *	acquired during the operation too.
+ *	On remove and lookup from the cache splay tree, only the free
+ *	pages queue mutex is expected to be locked.
+ *	These rules allow for reliably checking for the presence of cached
+ *	pages with only the per-object lock held, thereby reducing contention
+ *	for the free pages queue mutex.
+ *
  * List of locks
  *	(c)	const until freed
+ *	(o)	per-object mutex
+ *	(f)	free pages queue mutex
  *
  */
 
@@ -102,7 +115,7 @@ struct vm_object {
 	vm_ooffset_t backing_object_offset;/* Offset in backing object */
 	TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */
 	LIST_HEAD(, vm_reserv) rvq;	/* list of reservations */
-	vm_page_t cache;		/* root of the cache page splay tree */
+	vm_page_t cache;		/* (o + f) root of the cache page splay tree */
 	void *handle;
 	union {
 		/*



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