Re: [PATCH v3 10/12] x86/mm: Implement HAVE_ARCH_UNMAPPED_AREA_VMFLAGS

From: Edgecombe, Rick P
Date: Sun Mar 17 2024 - 21:00:31 EST


On Wed, 2024-03-13 at 09:00 -0700, Rick Edgecombe wrote:
> > Wouldn't it be better to define those two as static inlines ?
>
> Yes, I think so.

I gave this a try and it turned out not to fit into any header too
well. I decided putting it into a generic header was not great since
these are actually supposed to be arch implementations. Emphasizing
that point, mmap.c actually defines these unless
HAVE_ARCH_UNMAPPED_AREA is defined. So to make it work, mm.h would have
to assume that if HAVE_ARCH_UNMAPPED_AREA and
HAVE_ARCH_UNMAPPED_AREA_TOPDOWN are defined, the arch actually doesn't
have an arch_unmmapped_area() and wants a static inline version of
arch_get_unmapped_area(). It confuses the meaning of
HAVE_ARCH_UNMAPPED_AREA a bit to mean the opposite in some cases.
Adding a ARCH_WANTS_UNMAPPED_AREA_INLINE seemed excessive.

As for putting them in an arch/x86 header, I tried asm/mmu.h, but
arch_get_unmapped_area_topdown/_vmflags() had to be forward declared.
But then also vm_flags_t couldn't be pulled in properly because of a
circular dependency. A few others hit weirdness or breakages.

So in the end, I decided to just leave it as a non-static inline in
arch/x86. Unless there are any objections, I'm going to just let 0-day
build test all the archs, and I'll post the series with the rest of the
feedback in a few days.