Re: [PATCH 3/6] mm: always inline __mk_vma_flags() and invoked functions

Andrew Morton
2026-03-25T19:11:51Z

On Wed, 25 Mar 2026 18:44:13 +0000 "Lorenzo Stoakes (Oracle)" <ljs@kernel.org> wrote:

> > : Be explicit about __mk_vma_flags() (which is used by the mk_vma_flags()
> > : macro) always being inline, as we rely on the compiler turning all
> > : constants into compile-time ones.
> >
>
> Well I think that loses the meaning a bit.
>
> Something like:
>
> Be explicit about __mk_vma_flags() (which is used by the mk_vma_flags()
> -macro) always being inline, as we rely on the compiler converting this
> -function into meaningful.
> +macro) always being inline, as we rely on the compiler to evaluate the
> +loop in this function and determine that it can replace the code with the
> +an equivalent constant value, e.g. that:
> +
> +__mk_vma_flags(2, (const vma_flag_t []){ VMA_WRITE_BIT, VMA_EXEC_BIT });
> +
> +Can be replaced with:
> +
> +(1UL << VMA_WRITE_BIT) | (1UL << VMA_EXEC_BIT)
> +
> += (1UL << 1) | (1UL << 2) = 6
> +
> +Most likely an 'inline' will suffice for this, but be explicit as we can
> +be.
>
> Should verbosely cover that off.

ok ;)