From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754268AbcHWUb2 (ORCPT ); Tue, 23 Aug 2016 16:31:28 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52654 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbcHWUb1 (ORCPT ); Tue, 23 Aug 2016 16:31:27 -0400 Date: Tue, 23 Aug 2016 22:31:03 +0200 From: Peter Zijlstra To: Waiman Long Cc: Linus Torvalds , Jason Low , Ding Tianhong , Thomas Gleixner , Will Deacon , Ingo Molnar , Imre Deak , Linux Kernel Mailing List , Davidlohr Bueso , Tim Chen , Terry Rudd , "Paul E. McKenney" , Jason Low Subject: Re: [RFC][PATCH 1/3] locking/mutex: Rework mutex::owner Message-ID: <20160823203103.GT10153@twins.programming.kicks-ass.net> References: <20160823124617.015645861@infradead.org> <20160823124856.763266868@infradead.org> <57BCAF72.7020904@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57BCAF72.7020904@hpe.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 23, 2016 at 04:17:54PM -0400, Waiman Long wrote: > On 08/23/2016 08:46 AM, Peter Zijlstra wrote: > > /* > > * Simple, straightforward mutexes with strict semantics: > >@@ -48,13 +49,9 @@ > > * locks and tasks (and only those tasks) > > */ > > struct mutex { > >- /* 1: unlocked, 0: locked, negative: locked, possible waiters */ > >- atomic_t count; > >+ atomic_long_t owner; > > spinlock_t wait_lock; > > struct list_head wait_list; > >-#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER) > >- struct task_struct *owner; > >-#endif > > #ifdef CONFIG_MUTEX_SPIN_ON_OWNER > > struct optimistic_spin_queue osq; /* Spinner MCS lock */ > > #endif > > I think you should put the wait_lock and osq next to each other to save 8 > bytes in space on 64-bit machines. Right you are.. didn't get around to looking at layout yet. Just barely got it to compile and boot :-)