Re: [PATCH net-next v1] mm: fix build on powerpc with GCC 14

From: Matthew Wilcox
Date: Sun Sep 15 2024 - 06:45:14 EST


On Sat, Sep 14, 2024 at 08:50:46AM +0200, Christophe Leroy wrote:
> Hi,
>
> Le 13/09/2024 à 21:22, Matthew Wilcox a écrit :
> > On Fri, Sep 13, 2024 at 07:20:36PM +0000, Mina Almasry wrote:
> > > +++ b/include/linux/page-flags.h
> > > @@ -239,8 +239,8 @@ static inline unsigned long _compound_head(const struct page *page)
> > > {
> > > unsigned long head = READ_ONCE(page->compound_head);
> > > - if (unlikely(head & 1))
> > > - return head - 1;
> > > + if (unlikely(head & 1UL))
> > > + return head & ~1UL;
> > > return (unsigned long)page_fixed_fake_head(page);
> >
> > NAK, that pessimises compound_head().
> >
>
> Can you please give more details on what the difference is ?
>
> I can't see what it pessimises. In both cases, you test if the value is odd,
> when it is odd you make it even.

On x86, for example, it is perfectly valid to load a 64-bit value from
an offset of 0x2f relative to a pointer. So there's no need to make it
even.