On Mon, 29 Feb 2016 10:42:21 +1100 Balbir Singh <bsingharora@xxxxxxxxx> wrote: > > unsigned long function_to_ftrace_location(unsigned long addr) > > { > > const struct dyn_ftrace *rec; > > const struct ftrace_page *pg; > > unsigned long symbol_size, offset, post_addr; > > unsigned long ret = 0UL; > > > > if (!kallsyms_lookup_size_offset(addr, &symbol_size, &offset)) > > return 0UL; > > > > addr -= offset; > > post_addr = addr += symbol_size; > > > > mutex_lock(&ftrace_lock); > > do_for_each_ftrace_rec(pg, rec) { > > if (rec->ip >= addr && rec->ip < post_addr ) { > > ret = rec->ip; > > goto end; > > } > > } while_for_each_ftrace_rec() > > I thought of this as well, I was thinking of modifying ftrace_location(), but that would be a larger change Or look at what ftarce_location_range() does, and add a similar function. The ftrace_location*() function optimize the fact that the pg pages are ordered in a link list, and the recs in the pg are also sorted. -- Steve > > end: > > mutex_unlock(&ftrace_lock); > > > > return ret; > > } > > > -- To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html