Re: [RFC tip/locking/lockdep v5 15/17] lockdep: Reduce the size of lock_list

2018-02-23 Thread Boqun Feng
On Fri, Feb 23, 2018 at 12:38:43PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 22, 2018 at 03:09:02PM +0800, Boqun Feng wrote:
> > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
> > index a1f91f8680bd..3fce8dbf5091 100644
> > --- a/include/linux/lockdep.h
> > +++ b/include/linux/lockdep.h
> > @@ -186,11 +186,11 @@ struct lock_list {
> > struct list_headentry;
> > struct lock_class   *class;
> > struct stack_trace  trace;
> > -   int distance;
> > +   u16 distance;
> > /* bitmap of different dependencies from head to this */
> > -   u16 dep;
> > +   u8  dep;
> > /* used by BFS to record whether this is picked as a recursive read */
> > -   u16 is_rr;
> > +   boolis_rr;
> 
> Don't use bool, use u8 if you want a single byte. sizeof(_Bool) is part
> of the architecture ABI and can be up to 4 bytes (well really anything,
> but I've not seen it bigger than 4 bytes for any sane implementation).

Got it, thanks!

Regards,
Boqun


signature.asc
Description: PGP signature


Re: [RFC tip/locking/lockdep v5 15/17] lockdep: Reduce the size of lock_list

2018-02-23 Thread Peter Zijlstra
On Thu, Feb 22, 2018 at 03:09:02PM +0800, Boqun Feng wrote:
> diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
> index a1f91f8680bd..3fce8dbf5091 100644
> --- a/include/linux/lockdep.h
> +++ b/include/linux/lockdep.h
> @@ -186,11 +186,11 @@ struct lock_list {
>   struct list_headentry;
>   struct lock_class   *class;
>   struct stack_trace  trace;
> - int distance;
> + u16 distance;
>   /* bitmap of different dependencies from head to this */
> - u16 dep;
> + u8  dep;
>   /* used by BFS to record whether this is picked as a recursive read */
> - u16 is_rr;
> + boolis_rr;

Don't use bool, use u8 if you want a single byte. sizeof(_Bool) is part
of the architecture ABI and can be up to 4 bytes (well really anything,
but I've not seen it bigger than 4 bytes for any sane implementation).