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 B8CEDC07E9D for ; Sat, 24 Sep 2022 12:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbiIXMLS (ORCPT ); Sat, 24 Sep 2022 08:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233797AbiIXMLN (ORCPT ); Sat, 24 Sep 2022 08:11:13 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6234889CFF; Sat, 24 Sep 2022 05:11:12 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MZSS318SVzlXL7; Sat, 24 Sep 2022 20:06:59 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 20:11:10 +0800 Received: from [10.174.178.55] (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 20:11:09 +0800 Subject: Re: [PATCH v5 08/10] livepatch: Improve the search performance of module_kallsyms_on_each_symbol() From: "Leizhen (ThunderTown)" To: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , , , Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , "Luis Chamberlain" , , "Steven Rostedt" , Ingo Molnar References: <20220923112033.1958-1-thunder.leizhen@huawei.com> <20220923112033.1958-9-thunder.leizhen@huawei.com> <4ef46874-4dbc-2663-ebad-7adbbbfa3b18@huawei.com> Message-ID: <6cddc5ab-6af5-c221-9383-a45d955af52b@huawei.com> Date: Sat, 24 Sep 2022 20:10:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <4ef46874-4dbc-2663-ebad-7adbbbfa3b18@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/9/24 9:11, Leizhen (ThunderTown) wrote: > > On 2022/9/23 19:20, Zhen Lei wrote: >> 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. >> >> In order to achieve this purpose, split the call to hook 'fn' into two >> phases: >> 1. Finds the given module. Pass pointer 'mod'. Hook 'fn' directly returns >> the comparison result of the module name without comparing the function >> name. >> 2. Finds the given function in that module. Pass pointer 'mod = NULL'. >> Hook 'fn' skip the comparison of module name and directly compare >> function names. > Sorry, I forgot to change the description. I will fix it in v6, after I've > collected review comments. Oh, It's Saturday, and I don't think anyone's seen v5 yet. So I'll post the v6. Please skip v5. > -- Regards, Zhen Lei