From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756630Ab3JHUf2 (ORCPT ); Tue, 8 Oct 2013 16:35:28 -0400 Received: from mga09.intel.com ([134.134.136.24]:25639 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755116Ab3JHUf0 (ORCPT ); Tue, 8 Oct 2013 16:35:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,1058,1371106800"; d="scan'208";a="390131409" Subject: Re: [PATCH v8 5/9] MCS Lock: Restructure the MCS lock defines and locking code into its own file From: Tim Chen To: Rafael Aquini Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Peter Zijlstra , Rik van Riel , Peter Hurley , "Paul E.McKenney" , Jason Low , Waiman Long , linux-kernel@vger.kernel.org, linux-mm In-Reply-To: <20131008195100.GA21046@localhost.localdomain> References: <1380753512.11046.87.camel@schen9-DESK> <20131008195100.GA21046@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" Date: Tue, 08 Oct 2013 13:34:55 -0700 Message-ID: <1381264495.11046.110.camel@schen9-DESK> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-1.fc14) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2013-10-08 at 16:51 -0300, Rafael Aquini wrote: > On Wed, Oct 02, 2013 at 03:38:32PM -0700, Tim Chen wrote: > > We will need the MCS lock code for doing optimistic spinning for rwsem. > > Extracting the MCS code from mutex.c and put into its own file allow us > > to reuse this code easily for rwsem. > > > > Reviewed-by: Ingo Molnar > > Reviewed-by: Peter Zijlstra > > Signed-off-by: Tim Chen > > Signed-off-by: Davidlohr Bueso > > --- > > include/linux/mcs_spinlock.h | 64 ++++++++++++++++++++++++++++++++++++++++++ > > include/linux/mutex.h | 5 ++- > > kernel/mutex.c | 60 ++++---------------------------------- > > 3 files changed, 74 insertions(+), 55 deletions(-) > > create mode 100644 include/linux/mcs_spinlock.h > > > > diff --git a/include/linux/mcs_spinlock.h b/include/linux/mcs_spinlock.h > > new file mode 100644 > > index 0000000..b5de3b0 > > --- /dev/null > > +++ b/include/linux/mcs_spinlock.h > > @@ -0,0 +1,64 @@ > > +/* > > + * MCS lock defines > > + * > > + * This file contains the main data structure and API definitions of MCS lock. > > + * > > + * The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spin-lock > > + * with the desirable properties of being fair, and with each cpu trying > > + * to acquire the lock spinning on a local variable. > > + * It avoids expensive cache bouncings that common test-and-set spin-lock > > + * implementations incur. > > + */ > > nitpick: > > I believe you need > > +#include > > here, to avoid breaking the build when arch_mutex_cpu_relax() is not defined > (arch/s390 is one case) Probably +#include should be added instead? It defines arch_mutex_cpu_relax when there's no architecture specific version. Thanks. Tim From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by kanga.kvack.org (Postfix) with ESMTP id 7EF196B0031 for ; Tue, 8 Oct 2013 16:35:35 -0400 (EDT) Received: by mail-pd0-f170.google.com with SMTP id x10so9316705pdj.29 for ; Tue, 08 Oct 2013 13:35:35 -0700 (PDT) Subject: Re: [PATCH v8 5/9] MCS Lock: Restructure the MCS lock defines and locking code into its own file From: Tim Chen In-Reply-To: <20131008195100.GA21046@localhost.localdomain> References: <1380753512.11046.87.camel@schen9-DESK> <20131008195100.GA21046@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" Date: Tue, 08 Oct 2013 13:34:55 -0700 Message-ID: <1381264495.11046.110.camel@schen9-DESK> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Rafael Aquini Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Peter Zijlstra , Rik van Riel , Peter Hurley , "Paul E.McKenney" , Jason Low , Waiman Long , linux-kernel@vger.kernel.org, linux-mm On Tue, 2013-10-08 at 16:51 -0300, Rafael Aquini wrote: > On Wed, Oct 02, 2013 at 03:38:32PM -0700, Tim Chen wrote: > > We will need the MCS lock code for doing optimistic spinning for rwsem. > > Extracting the MCS code from mutex.c and put into its own file allow us > > to reuse this code easily for rwsem. > > > > Reviewed-by: Ingo Molnar > > Reviewed-by: Peter Zijlstra > > Signed-off-by: Tim Chen > > Signed-off-by: Davidlohr Bueso > > --- > > include/linux/mcs_spinlock.h | 64 ++++++++++++++++++++++++++++++++++++++++++ > > include/linux/mutex.h | 5 ++- > > kernel/mutex.c | 60 ++++---------------------------------- > > 3 files changed, 74 insertions(+), 55 deletions(-) > > create mode 100644 include/linux/mcs_spinlock.h > > > > diff --git a/include/linux/mcs_spinlock.h b/include/linux/mcs_spinlock.h > > new file mode 100644 > > index 0000000..b5de3b0 > > --- /dev/null > > +++ b/include/linux/mcs_spinlock.h > > @@ -0,0 +1,64 @@ > > +/* > > + * MCS lock defines > > + * > > + * This file contains the main data structure and API definitions of MCS lock. > > + * > > + * The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spin-lock > > + * with the desirable properties of being fair, and with each cpu trying > > + * to acquire the lock spinning on a local variable. > > + * It avoids expensive cache bouncings that common test-and-set spin-lock > > + * implementations incur. > > + */ > > nitpick: > > I believe you need > > +#include > > here, to avoid breaking the build when arch_mutex_cpu_relax() is not defined > (arch/s390 is one case) Probably +#include should be added instead? It defines arch_mutex_cpu_relax when there's no architecture specific version. Thanks. Tim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org