Re: [PATCH 09/10] x86/rcu: Add rcu_preempt_count

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

 



Hello, Frederic

Thanks for reviewing.

On Mon, Apr 22, 2024 at 7:05 PM Frederic Weisbecker <frederic@xxxxxxxxxx> wrote:

> > +
> > +/* We use the MSB mostly because its available */
>
> I think you can safely remove the "We " from all the comments :-)

The file is mainly copied from arch/x86/include/asm/preempt.h.
I will rephrase sentences in later iterations.

>
> > +#define RCU_PREEMPT_UNLOCK_SPECIAL_INVERTED  0x80000000
>
> How about RCU_PREEMPT_UNLOCK_FASTPATH ?


I'm not good at naming. But the MSB really means exactly the opposite
of current->rcu_read_unlock_special and I think "UNLOCK_SPECIAL_INVERTED"
fits the meaning.

>
> > +
> > +/*
> > + * We use the RCU_PREEMPT_UNLOCK_SPECIAL_INVERTED bit as an inverted
> > + * current->rcu_read_unlock_special.s such that a decrement hitting 0
> > + * means we can and should call rcu_read_unlock_special().
> > + */
> > +#define RCU_PREEMPT_INIT     (0 + RCU_PREEMPT_UNLOCK_SPECIAL_INVERTED)
>
> Or simply:
>
> #define RCU_PREEMPT_INIT     RCU_PREEMPT_UNLOCK_FASTPATH
>
> Or you can even remove RCU_PREEMPT_INIT and use RCU_PREEMPT_UNLOCK_FASTPATH directly.

"0" means the initial rcu_preempt_count is 0 for the initial task.

> > +
> > +#endif // #ifdef CONFIG_PCPU_RCU_PREEMPT_COUNT
> > +
> > +#endif /* __ASM_RCU_PREEMPT_H */
> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> > index ba8cf5e9ce56..0b204a649442 100644
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -1992,9 +1992,10 @@ static __init int setup_clearcpuid(char *arg)
> >  __setup("clearcpuid=", setup_clearcpuid);
> >
> >  DEFINE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot) = {
> > -     .current_task   = &init_task,
> > -     .preempt_count  = INIT_PREEMPT_COUNT,
> > -     .top_of_stack   = TOP_OF_INIT_STACK,
> > +     .current_task           = &init_task,
> > +     .preempt_count          = INIT_PREEMPT_COUNT,
> > +     .top_of_stack           = TOP_OF_INIT_STACK,
> > +     .rcu_preempt_count      = RCU_PREEMPT_INIT,
>
> #ifdef CONFIG_PCPU_RCU_PREEMPT_COUNT ?
>
> Thanks.

Fixed in V2:
https://lore.kernel.org/lkml/20240407090558.3395-1-jiangshanlai@xxxxxxxxx/

Thanks
Lai

>
>
> >  };
> >  EXPORT_PER_CPU_SYMBOL(pcpu_hot);
> >  EXPORT_PER_CPU_SYMBOL(const_pcpu_hot);
> > --
> > 2.19.1.6.gb485710b
> >





[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