From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv6 3/5] gnttab: split grant table lock into table and maptrack locks Date: Wed, 29 Apr 2015 11:53:50 +0100 Message-ID: <5540B83E.3040701@citrix.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YnPcq-0003fh-3h for xen-devel@lists.xenproject.org; Wed, 29 Apr 2015 10:53:56 +0000 In-Reply-To: <55392620020000780007553E@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , David Vrabel Cc: Keir Fraser , Ian Campbell , Christoph Egger , Tim Deegan , Matt Wilson , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org 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. David