Re: [PATCH 3/6] mm: always inline __mk_vma_flags() and invoked functions
Andrew Morton <[email protected]> Wed, 25 Mar 2026 12:11:45 -0700
| Newsgroups | dev.linux.lists.ntfs3,dev.linux.lists.nvdimm,org.kernel.vger.linux-cxl,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kvack.linux-mm,org.ozlabs.lists.linux-erofs |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 25 Mar 2026 18:44:13 +0000 "Lorenzo Stoakes (Oracle)" <[email protected]> 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 ;)