From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 18:34:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096E71065675; Fri, 22 Jun 2012 18:34:12 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E85E38FC0C; Fri, 22 Jun 2012 18:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MIYBtS093751; Fri, 22 Jun 2012 18:34:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MIYBMn093749; Fri, 22 Jun 2012 18:34:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206221834.q5MIYBMn093749@svn.freebsd.org> From: Attilio Rao Date: Fri, 22 Jun 2012 18:34:11 +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: r237451 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 18:34:12 -0000 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 { /*