linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: lockref: Use bloated_spinlocks to avoid explicit config dependencies
Date: Wed, 6 Nov 2013 15:31:12 +0200	[thread overview]
Message-ID: <20131106133112.GB22132@shutemov.name> (raw)
In-Reply-To: <20131106111845.GG26785@twins.programming.kicks-ass.net>

On Wed, Nov 06, 2013 at 12:18:45PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 06, 2013 at 10:31:31AM +0100, Peter Zijlstra wrote:
> > Subject: mm: Properly separate the bloated ptl from the regular case
> > 
> > Use kernel/bounds.c to convert build-time spinlock_t size into a
> > preprocessor symbol and apply that to properly separate the page::ptl
> > situation.
> > 
> > Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> > ---
> >  include/linux/mm.h       | 24 +++++++++++++-----------
> >  include/linux/mm_types.h |  9 +++++----
> >  kernel/bounds.c          |  2 ++
> >  mm/memory.c              | 11 +++++------
> >  4 files changed, 25 insertions(+), 21 deletions(-)
> > 
> > diff --git a/kernel/bounds.c b/kernel/bounds.c
> > index e8ca97b5c386..5982437eca2c 100644
> > --- a/kernel/bounds.c
> > +++ b/kernel/bounds.c
> > @@ -11,6 +11,7 @@
> >  #include <linux/kbuild.h>
> >  #include <linux/page_cgroup.h>
> >  #include <linux/log2.h>
> > +#include <linux/spinlock.h>
> >  
> >  void foo(void)
> >  {
> > @@ -21,5 +22,6 @@ void foo(void)
> >  #ifdef CONFIG_SMP
> >  	DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
> >  #endif
> > +	DEFINE(BLOATED_SPINLOCKS, sizeof(spinlock_t) > sizeof(int));
> >  	/* End of constants */
> >  }
> 
> Using that we could also do.. not been near a compiler.
> 

[ Subject adjusted, CC: +Linus ]
> ---
> Subject: lockref: Use bloated_spinlocks to avoid explicit config dependencies
> 
> Avoid the fragile Kconfig construct guestimating spinlock_t sizes; use a
> friendly compile-time test to determine this.
> 
> Not-Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> ---
>  lib/Kconfig   | 3 ---
>  lib/lockref.c | 2 +-
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/lib/Kconfig b/lib/Kconfig
> index b3c8be0da17f..254af289d1d0 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -54,9 +54,6 @@ config ARCH_USE_CMPXCHG_LOCKREF
>  config CMPXCHG_LOCKREF
>  	def_bool y if ARCH_USE_CMPXCHG_LOCKREF
>  	depends on SMP
> -	depends on !GENERIC_LOCKBREAK
> -	depends on !DEBUG_SPINLOCK
> -	depends on !DEBUG_LOCK_ALLOC
>  
>  config CRC_CCITT
>  	tristate "CRC-CCITT functions"
> diff --git a/lib/lockref.c b/lib/lockref.c
> index 6f9d434c1521..a158fd86aa1a 100644
> --- a/lib/lockref.c
> +++ b/lib/lockref.c
> @@ -1,7 +1,7 @@
>  #include <linux/export.h>
>  #include <linux/lockref.h>
>  
> -#ifdef CONFIG_CMPXCHG_LOCKREF
> +#if defined(CONFIG_CMPXCHG_LOCKREF) && !BLOATED_SPINLOCKS

Having CONFIG_CMPXCHG_LOCKREF=y, but not really using it could be
misleading.
Should we get rid of CONFIG_CMPXCHG_LOCKREF completely and have here:

#if defined(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
	defined(CONFIG_SMP) && !BLOATED_SPINLOCKS

?

-- 
 Kirill A. Shutemov

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-11-06 14:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 11:53 [PATCH] mm: create a separate slab for page->ptl allocation Kirill A. Shutemov
2013-10-22 12:55 ` Fengguang Wu
2013-11-04 10:42 ` Kirill A. Shutemov
2013-11-05 23:01 ` Andrew Morton
2013-11-05 22:42   ` Kirill A. Shutemov
2013-11-05 23:56     ` Andrew Morton
2013-11-05 23:13       ` Kirill A. Shutemov
2013-11-06  0:43         ` Andrew Morton
2013-11-06  9:31         ` Peter Zijlstra
2013-11-06 11:18           ` Peter Zijlstra
2013-11-06 13:31             ` Kirill A. Shutemov [this message]
2013-11-06 14:32               ` lockref: Use bloated_spinlocks to avoid explicit config dependencies Peter Zijlstra
2013-11-06 13:21           ` [PATCH] mm: create a separate slab for page->ptl allocation Kirill A. Shutemov
2013-11-06 14:30             ` Peter Zijlstra
2013-11-06 10:34         ` Will Deacon
2013-11-06 10:49           ` Geert Uytterhoeven
2013-11-06 11:02           ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131106133112.GB22132@shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).