From owner-svn-src-head@freebsd.org Wed Aug 5 16:36:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE03C37B0C5; Wed, 5 Aug 2020 16:36:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BMHMV4sG1z3YQS; Wed, 5 Aug 2020 16:36:54 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mousie.catspoiler.org (unknown [76.212.85.177]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: truckman) by smtp.freebsd.org (Postfix) with ESMTPSA id EB5D820610; Wed, 5 Aug 2020 16:36:53 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Date: Wed, 5 Aug 2020 09:36:52 -0700 (PDT) From: Don Lewis Subject: Re: svn commit: r363891 - head/sys/kern To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <202008050924.0759Oc3H010909@repo.freebsd.org> Message-ID: References: <202008050924.0759Oc3H010909@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Wed, 05 Aug 2020 16:36:54 -0000 On 5 Aug, Mateusz Guzik wrote: > Author: mjg > Date: Wed Aug 5 09:24:38 2020 > New Revision: 363891 > URL: https://svnweb.freebsd.org/changeset/base/363891 > > Log: > cache: reduce zone alignment to 8 bytes > > It used to be sizeof of the given struct to accomodate for 32 bit mips > doing 64 bit loads, but the same can be achieved with requireing just > 64 bit alignment. > > While here reorder struct namecache so that most commonly used fields > are closer. > > Modified: > head/sys/kern/vfs_cache.c > > Modified: head/sys/kern/vfs_cache.c > ============================================================================== > --- head/sys/kern/vfs_cache.c Wed Aug 5 09:24:00 2020 (r363890) > +++ head/sys/kern/vfs_cache.c Wed Aug 5 09:24:38 2020 (r363891) > @@ -122,9 +122,9 @@ _Static_assert(sizeof(struct negstate) <= sizeof(struc > "the state must fit in a union with a pointer without growing it"); > > struct namecache { > - CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */ > LIST_ENTRY(namecache) nc_src; /* source vnode list */ > TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ > + CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */ > struct vnode *nc_dvp; /* vnode of parent of name */ > union { > struct vnode *nu_vp; /* vnode the name refers to */ > @@ -142,6 +142,8 @@ struct namecache { > * to be stored. The nc_dotdottime field is used when a cache entry is mapping > * both a non-dotdot directory name plus dotdot for the directory's > * parent. > + * > + * See below for alignment requirement. > */ > struct namecache_ts { > struct timespec nc_time; /* timespec provided by fs */ > @@ -150,6 +152,14 @@ struct namecache_ts { > struct namecache nc_nc; > }; > > +/* > + * At least mips n32 performs 64-bit accesses to timespec as found > + * in namecache_ts and requires them to be aligned. Since others > + * may be in the same spot suffer a little bit and enforce the > + * alignment for everyone. Note this is a nop for 64-bit platforms. > + */ > +#define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) time_t is only 32 bits on i386