From: "Jan Beulich" Subject: Re: [PATCHv6 3/5] gnttab: split grant table lock into table and maptrack locks Date: Wed, 29 Apr 2015 12:12:11 +0100 Message-ID: <5540CA9B02000078000CE02E@mail.emea.novell.com> References: <1429718436-9782-1-git-send-email-david.vrabel@citrix.com> <1429718436-9782-4-git-send-email-david.vrabel@citrix.com> <55392620020000780007553E@mail.emea.novell.com> <5540B83E.3040701@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YnPuY-0004Tv-T7 for xen-devel@lists.xenproject.org; Wed, 29 Apr 2015 11:12:14 +0000 In-Reply-To: <5540B83E.3040701@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: david.vrabel@citrix.com Cc: keir@xen.org, ian.campbell@citrix.com, chegger@amazon.de, tim@xen.org, msw@amazon.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> David Vrabel 04/29/15 12:54 PM >>> >On 23/04/15 16:04, Jan Beulich wrote: >>> --- a/xen/include/xen/grant_table.h >>> +++ b/xen/include/xen/grant_table.h >>> @@ -82,7 +82,12 @@ struct grant_table { >>> struct grant_mapping **maptrack; >>> unsigned int maptrack_head; >>> unsigned int maptrack_limit; >>> - /* Lock protecting updates to active and shared grant tables. */ >>> + /* Lock protecting the maptrack page list, head, and limit */ >>> + spinlock_t maptrack_lock; >>> + /* >>> + * Lock protecting updates to grant table state (version, active >>> + * entry list, etc.) >>> + */ >>> spinlock_t lock; >> >> If the patch still was to be applied, these two locks should be put >> on separate cache lines, to avoid unnecessary bouncing. > >I was shuffling the fields around to make this happen and I ended up >shrinking the structure to fit it in a single cache line instead. > >Shall I add some explicit padding to get the alignment you want? Note >that with the per-CPU maptrack free lists the maptrack lock isn't >heavily contended. Ah, right. In that case artificially bloating the structure is likely not worth it. Jan