Re: [RFC PATCH] compiler.h: Introduce ptr_eq() to preserve address dependency

From: Boqun Feng
Date: Fri Sep 27 2024 - 19:21:45 EST


On Fri, Sep 27, 2024 at 07:05:53PM -0400, Mathieu Desnoyers wrote:
> On 2024-09-27 22:33, Mathieu Desnoyers wrote:
> [...]
>
> > ---
> > include/linux/compiler.h | 62 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 62 insertions(+)
> >
>
> I'm wondering if this really belongs in compiler.h, or if it's so
> RCU/HP specific that it should be implemented in rcupdate.h ?
>
> [... ]
> > +static __always_inline
> > +int ptr_eq(const volatile void *a, const volatile void *b)
>
> And perhaps rename this to rcu_ptr_eq() ?
>

I think the current place and name is fine, yes RCU is the most
important address dependency user, but there are other users as well.

Regards,
Boqun

> Thanks,
>
> Mathieu
>
> > +{
> > + OPTIMIZER_HIDE_VAR(a);
> > + OPTIMIZER_HIDE_VAR(b);
> > + return a == b;
> > +}
> > +
>
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com
>