From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B442DC678D7 for ; Tue, 17 Jan 2023 15:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbjAQP0a (ORCPT ); Tue, 17 Jan 2023 10:26:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232258AbjAQP0A (ORCPT ); Tue, 17 Jan 2023 10:26:00 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD4242BD2; Tue, 17 Jan 2023 07:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ncBv23GBOtVznu5V8yi8Fc2pb7QmZGyIJBgsXfrjyek=; b=KJCkWqqMZy63Yo91dHyY2RQzHo w872tiYCR/EYTCrC95EHnwhStO1BlLYn/Eg+B+1WrkB1t+yqmuhGs4NOl4ReTT4mwDre2snbodNQD E8B0U4FlRFtmbnwR+l1NT6ocueYvW6v4y0jP7DRJB9NsaWcyBb9gLz5vkPxnmk9yfANmBF3sS/rF4 N1LTKU7gwdn5pINdk+eyvGP/TCFWQAzg9UyboKd2pRwcpkdbZizwpJ7FKsLp+ilAoCP37wX73Yzpy qsoxuyvfdSqZdaBGoHhABOtnMdt3MLTeEMpFyMwGkivb0UsyOSG7pjkpL8F72uoRoULlCmLQzD2c5 vojvzhPg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHnqI-00EpSF-Sk; Tue, 17 Jan 2023 15:25:42 +0000 Date: Tue, 17 Jan 2023 07:25:42 -0800 From: Luis Chamberlain To: Miroslav Benes Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Josh Poimboeuf , Jiri Kosina , Petr Mladek , Zhen Lei , Song Liu , bpf@vger.kernel.org, live-patching@vger.kernel.org, linux-modules@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Joe Lawrence , Steven Rostedt , Masami Hiramatsu , Mark Rutland Subject: Re: [PATCHv3 bpf-next 1/3] livepatch: Improve the search performance of module_kallsyms_on_each_symbol() Message-ID: References: <20230116101009.23694-1-jolsa@kernel.org> <20230116101009.23694-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On Tue, Jan 17, 2023 at 03:47:15PM +0100, Miroslav Benes wrote: > On Mon, 16 Jan 2023, Jiri Olsa wrote: > > > From: Zhen Lei > > > > Currently we traverse all symbols of all modules to find the specified > > function for the specified module. But in reality, we just need to find > > the given module and then traverse all the symbols in it. > > > > Let's add a new parameter 'const char *modname' to function > > module_kallsyms_on_each_symbol(), then we can compare the module names > > directly in this function and call hook 'fn' after matching. If 'modname' > > is NULL, the symbols of all modules are still traversed for compatibility > > with other usage cases. > > > > Phase1: mod1-->mod2..(subsequent modules do not need to be compared) > > | > > Phase2: -->f1-->f2-->f3 > > > > Assuming that there are m modules, each module has n symbols on average, > > then the time complexity is reduced from O(m * n) to O(m) + O(n). > > > > Reviewed-by: Petr Mladek > > Acked-by: Song Liu > > Signed-off-by: Zhen Lei > > Signed-off-by: Jiri Olsa > > Acked-by: Miroslav Benes Yes, queued up, thanks! Luis