On Sat, Nov 2, 2024 at 3:37 AM Rong Xu <xur@xxxxxxxxxx> wrote: > > Current order is: > .text.hot, .text, .text_unlikely, .text.unknown, .text.asan > > The patch reorders them to: > .text.asan, .text.unknown, .text_unlikely, .text.hot, .text > > The majority of the code resides in three sections: .text.hot, .text, and > .text.unlikely, with .text.unknown containing a negligible amount. > .text.asan is only generated in ASAN builds. > > Our primary goal is to group code segments based on their execution > frequency (hotness). > > First, we want to place .text.hot adjacent to .text. Since we cannot put > .text.hot after .text (Due to constraints with -ffunction-sections, > placing .text.hot after .text is problematic), we need to put > .text.hot before .text. > > Then it comes to .text.unlikely, we cannot put it after .text > (same -ffunction-sections issue) . Therefore, we'll position .text.unlikely > before .text.hot. > > .text.unknown and .tex.asan follow the same logic. > > This revised ordering effectively reverses the original arrangement (for > .text.unlikely, .text.unknown, and .tex.asan), maintaining a similar level of > affinity between sections. > > I hope this explains the reason for the new ordering. Make sense. Please describe the above in the commit description. Then, it will be clearer why you not only moved up fixed patterns but also reversed the order. -- Best Regards Masahiro Yamada