Re: [PATCH rcu 3/6] srcu,notifier: Remove #ifdefs in favor of SRCU Tiny srcu_usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 17, 2023 at 11:09:56AM -0700, Linus Torvalds wrote:
> On Mon, 17 Jul 2023 at 11:03, Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
> >
> > +// Dummy structure for srcu_notifier_head.
> > +struct srcu_usage {
> > +       char srcuu_dummy;
> > +};
> > +
> > +#define __SRCU_USAGE_INIT(name) { .srcuu_dummy = 0, }
> 
> You really should be able to just do
> 
>    struct srcu_usage { };
>    #define __SRCU_USAGE_INIT(name) { }
> 
> which is something we've done for ages for spinlocks in
> 
>     include/linux/spinlock_types_up.h
> 
> because while we had a gcc bug wrt empty structures, that was ages ago
> (ie "gcc-2.x").
> 
> See commit a1365647022e ("[PATCH] remove gcc-2 checks") from 2006.
> 
> So we've already had these kinds of empty dummy structs for literally
> over a decade in active use. Exactly so that you can avoid having to
> use #ifdef's etc, and can just always assume you have a spinlock, even
> if it doesn't generate any code or any data overhead.

Showing my age again, I guess.  ;-)

Thank you for the hint!  I will rework this as you suggest.

							Thanx, Paul



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux