From owner-svn-src-all@FreeBSD.ORG Mon Jan 14 05:46:50 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 15FB3BB9; Mon, 14 Jan 2013 05:46:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03F4D2D0; Mon, 14 Jan 2013 05:46:50 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0E5kngV051538; Mon, 14 Jan 2013 05:46:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0E5kn6G051536; Mon, 14 Jan 2013 05:46:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301140546.r0E5kn6G051536@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 14 Jan 2013 05:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245410 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Mon, 14 Jan 2013 05:46:50 -0000 Author: kib Date: Mon Jan 14 05:46:49 2013 New Revision: 245410 URL: http://svnweb.freebsd.org/changeset/base/245410 Log: Rearrange the struct bufobj and struct vnode layouts to reduce padding. On the amd64 kernel with INVARIANTS turned off, size of the struct vnode is reduced from 496 to 472 bytes, saving 24 bytes of memory and KVA per vnode. Noted and reviewed by: peter Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/bufobj.h head/sys/sys/vnode.h Modified: head/sys/sys/bufobj.h ============================================================================== --- head/sys/sys/bufobj.h Mon Jan 14 05:45:33 2013 (r245409) +++ head/sys/sys/bufobj.h Mon Jan 14 05:46:49 2013 (r245410) @@ -89,12 +89,7 @@ struct buf_ops { struct bufobj { struct mtx bo_mtx; /* Mutex which protects "i" things */ - struct bufv bo_clean; /* i Clean buffers */ - struct bufv bo_dirty; /* i Dirty buffers */ - long bo_numoutput; /* i Writes in progress */ - u_int bo_flag; /* i Flags */ struct buf_ops *bo_ops; /* - Buffer operations */ - int bo_bsize; /* - Block size for i/o */ struct vm_object *bo_object; /* v Place to store VM object */ LIST_ENTRY(bufobj) bo_synclist; /* S dirty vnode list */ void *bo_private; /* private pointer */ @@ -103,6 +98,11 @@ struct bufobj { * XXX: only to keep the syncer working * XXX: for now. */ + struct bufv bo_clean; /* i Clean buffers */ + struct bufv bo_dirty; /* i Dirty buffers */ + long bo_numoutput; /* i Writes in progress */ + u_int bo_flag; /* i Flags */ + int bo_bsize; /* - Block size for i/o */ }; /* Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Mon Jan 14 05:45:33 2013 (r245409) +++ head/sys/sys/vnode.h Mon Jan 14 05:46:49 2013 (r245410) @@ -99,7 +99,6 @@ struct vnode { * Fields which define the identity of the vnode. These fields are * owned by the filesystem (XXX: and vgone() ?) */ - enum vtype v_type; /* u vnode type */ const char *v_tag; /* u type of underlying data */ struct vop_vector *v_op; /* u vnode operations vector */ void *v_data; /* u private data for fs */ @@ -122,10 +121,10 @@ struct vnode { } v_un; /* - * vfs_hash: (mount + inode) -> vnode hash. + * vfs_hash: (mount + inode) -> vnode hash. The hash value + * itself is grouped with other int fields, to avoid padding. */ LIST_ENTRY(vnode) v_hashlist; - u_int v_hash; /* * VFS_namecache stuff @@ -135,24 +134,11 @@ struct vnode { struct namecache *v_cache_dd; /* c Cache entry for .. vnode */ /* - * clustering stuff - */ - daddr_t v_cstart; /* v start block of cluster */ - daddr_t v_lasta; /* v last allocation */ - daddr_t v_lastw; /* v last write */ - int v_clen; /* v length of cur. cluster */ - - /* * Locking */ struct lock v_lock; /* u (if fs don't have one) */ struct mtx v_interlock; /* lock for "i" things */ struct lock *v_vnlock; /* u pointer to vnode lock */ - int v_holdcnt; /* i prevents recycling. */ - int v_usecount; /* i ref count of users */ - u_int v_iflag; /* i vnode flags (see below) */ - u_int v_vflag; /* v vnode flags */ - int v_writecount; /* v ref count of writers */ /* * The machinery of being a vnode @@ -167,6 +153,22 @@ struct vnode { struct label *v_label; /* MAC label for vnode */ struct lockf *v_lockf; /* Byte-level advisory lock list */ struct rangelock v_rl; /* Byte-range lock */ + + /* + * clustering stuff + */ + daddr_t v_cstart; /* v start block of cluster */ + daddr_t v_lasta; /* v last allocation */ + daddr_t v_lastw; /* v last write */ + int v_clen; /* v length of cur. cluster */ + + int v_holdcnt; /* i prevents recycling. */ + int v_usecount; /* i ref count of users */ + u_int v_iflag; /* i vnode flags (see below) */ + u_int v_vflag; /* v vnode flags */ + int v_writecount; /* v ref count of writers */ + u_int v_hash; + enum vtype v_type; /* u vnode type */ }; #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */