lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] locking: Introduce local_lock()
On 2020-05-20 14:04:50 [+0200], Peter Zijlstra wrote:
> On Tue, May 19, 2020 at 10:19:05PM +0200, Sebastian Andrzej Siewior wrote:
> > +/**
> > + * DEFINE_LOCAL_LOCK - Define and initialize a per CPU local lock
> > + * @lock: Name of the lock instance
> > + */
> > +#define DEFINE_LOCAL_LOCK(lvar) \
> > + DEFINE_PER_CPU(struct local_lock, lvar) = { INIT_LOCAL_LOCK(lvar) }
> > +
> > +/**
> > + * DECLARE_LOCAL_LOCK - Declare a defined per CPU local lock
> > + * @lock: Name of the lock instance
> > + */
> > +#define DECLARE_LOCAL_LOCK(lvar) \
> > + DECLARE_PER_CPU(struct local_lock, lvar)
>
> So I think I'm going to argue having these is a mistake. The local_lock
> should be put in a percpu structure along with the data it actually
> protects.

So I got rid of these and made the local_lock part of the per-CPU
struct.

> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > +# define LL_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }
>
> That wants to be:
>
> .dep_map = {
> .name = #lockname,
> .wait_type_inner = LD_WAIT_SPIN,

Why LD_WAIT_SPIN and not LD_WAIT_SLEEP? On RT the lock becomes sleeping
and none of the SPIN restrictions apply.

> }
>
> > +#else
> > +# define LL_DEP_MAP_INIT(lockname)
> > +#endif

Sebastian

\
 
 \ /
  Last update: 2020-05-22 13:06    [W:0.090 / U:55.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site