lkml.org 
[lkml]   [2012]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:x86/mm] x86/pat: Avoid contention on cpa_lock if possible
Hi,

On Wed, Jun 06, 2012 at 06:18:12PM -0400, Shai Fultheim (Shai@ScaleMP.com) wrote:
> Peter Zijlstra [mailto:a.p.zijlstra@chello.nl] wrote
> > On Wed, 2012-06-06 at 09:18 -0700, tip-bot for Shai Fultheim wrote:
> >
> > > [ I absolutely hate these locking patterns ... yet I have no better idea. Maybe the gents on Cc: ... ]
> > > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> >
> > Oh yuck, this is vile..
> >
> > static struct static_key scale_mp_trainwreck = STATIC_KEY_INIT_FALSE;
> >
> > static DEFINE_SPINLOCK(_cpa_lock);
> >
> > static inline void cpa_lock(void)
> > {
> > if (static_key_false(&scale_mp_trainwreck))
> > return;
> >
> > spin_lock(&_cpa_lock);
> > }
> >
> > static inline void cpa_unlock(void)
> > {
> > if (static_key_false(&scale_mp_trainwreck))
> > return;
> >
> > spin_lock(&_cpa_lock);
> > }
> >
> > And then use cpa_{,un}lock(), and the scale-mp guys can
> > static_key_slow_inc(&scale_mp_trainwreck).
> >
> > [ and yes I hate those jump_label names ... but I'm not wanting
> > to go through another round of bike-shed painting. ]
>
> Looks pretty straight forward to do.
> We will try this route, as I'm concerned that synthetic CPUID bit will be kind of a global change for a pretty local consideration.
>
> Comments?

The synthetic CPUID bit approach has the advantage of setting this bit
from the platform initialization code independently (in this case, in
vsmp_64.c) instead of calling platform specific functions from
pageattr.c (such as is_vsmp_box()) or exporting the static_key variable.

We'll give this a shot and send a revised patch after testing it.

Sounds good?

Thanks,
Ido.


\
 
 \ /
  Last update: 2012-06-07 03:41    [W:0.061 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site