On 2023/6/16 0:58, Song Liu wrote: > On Tue, Jun 13, 2023 at 8:16 AM Petr Mladek <pmladek@xxxxxxxx> wrote: >> > > [...] > >> >> I agree that it is a slow path. >> >> Well, Zhen put a lot of effort into the optimization. I am not sure >> what was the primary motivation. But it would be harsh to remove it >> without asking. >> >> Zhen, what was the motivation for the speedup of kallsyms, please? >> If a large number of functions are modified, livepatch may fail. In some actual scenarios(business), the patch needs to be activated within a limited time. > > I took a closer look at the code. kallsyms_on_each_match_symbol() > is only used by livepatch. So indeed it doesn't make sense to drop > all the optimizations by Zhen. Yes, if CLANG has special requirements, it can be specially addressed. I was thinking about CLANG, and I'll take a closer look at the current problem. > > I got another solution for this. Will send it shortly. > > Thanks, > Song > >> >>> OTOH, this version is simpler and should work just as >>> well. >> >> Sure. But we should double check Zhen's motivation. >> >> Anyway, iterating over all symbols costs a lot. See also >> the commit f5bdb34bf0c9314548f2d ("livepatch: Avoid CPU hogging >> with cond_resched"). > . > -- Regards, Zhen Lei