回复: [PATCH] elf: Make _dl_sort_maps prefer default DFS algorithm

李腾龙 <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
Hi,

On 13/08/26 22:18, Wilco Dijkstra wrote:
> >> The default dynamic_sort tunable is 2, which maps to
> >> dso_sort_algorithm_dfs. Update the likely branch to match the
> >> default, without changing behavior for valid tunable values.
> >
> > What does this change really gain here? I am inclined to avoid this kind of
> > code churn.
>
> Is this code executed frequently or is the sorting only done once? It the latter,
> it cannot help. And if the sorting itself is expensive, it would be more useful to
> optimize that instead.
>
> So removing the __glibc_likely is best overall.

Agreed. _dl_sort_maps is only called during shared object loading/unloading, not on any hot path, so the branch predictor hint has no measurable benefit. I'll send a v2 that removes __glibc_likely and uses a plain if/else instead.

Thanks,

litenglong
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.