On Mon, May 11, 2026 at 10:59 AM Ard Biesheuvel <[email protected]> wrote: > I think we should simply do something along the lines of the below, > considering that the size of a data object tends to correlate with > its minimum alignment. > > I do find it rather puzzling that the compiler emits empty_zero_page > *after* zero_page_pfn - ideally, we'd combine the below with > -fdata-sections so that the linker sees all individual objects, but > I suspect that would create some problems elsewhere. > > > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -452,7 +452,7 @@ > #define RO_AFTER_INIT_DATA \ > . = ALIGN(8); \ > __start_ro_after_init = .; \ > - *(.data..ro_after_init) \ > + *(SORT_BY_ALIGNMENT(.data..ro_after_init)) \
Oh, neat, I didn't realize that's possible. That seems like a nicer approach... (Assuming that it doesn't cause cache efficiency issues somehow, I imagine it could be possible that source-code-adjacent objects should also be located next to each other for cache/TLB efficiency... but I have no concrete reason to think that, just a thought.)

