Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3752450rwi; Wed, 2 Nov 2022 02:41:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CujjrpzjNwr//qgF9A+B1pCgFv3OXp939uPq+DULR4XOY2soh1BFfYL+gXYNR/2cWoTaz X-Received: by 2002:a17:903:2452:b0:186:99e0:672d with SMTP id l18-20020a170903245200b0018699e0672dmr24108713pls.95.1667382104097; Wed, 02 Nov 2022 02:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667382104; cv=none; d=google.com; s=arc-20160816; b=l09j0GJFLzwV5HB9htUoKnsy37wDaemG/OtBj3bychr/jsVL3ZP6jDDhVIPf/yL51F w+3rqH5kjsQ3RmxsfDuhgZ+OJdKE9jYNRPPZHIPDzAroxuPY/9xuJGaMlBbL92960/6F OGpH96/59w/DQKO8e8i6qjAgZfVLQZY7Ct5QfV1ggCKSFr+lPcBlyzbJ6hcC3BEDfAGa oxW+PogPHe9tiaUb3v1Vc5PLc4CMzkBD9GyMVQciGz3YqdztZGBVogOLRVGzHc3XCznK +sDmCBSqoc9MZ5d7aytpiZhlK+uJeZNhRJyeo65VtOr22P4dhTGVy1ofMDO2Y/Bwuabi 12rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=bxBR1zQwXG2e/9Z/vgvpCtn08U3fjFA4RKwtzoHNbC8=; b=zxY85FCDFBbsNThbtsfFykT/tIJsOC+Qqbr60jDooe/od5Ox7kLiF+Sg9h9nr8DiTk kORr9pyNYaTofA3+YjJSY2UwV6AiTIiEQHs6zx3+KLFZwVYE1vZ7LWaLPa4bcSM9xEuV AbnBXfSNpyqxiFFfzZave00YnBzqx/eDeRg2HB0bZbobM+sxm62nVql7PB5+B243G+Dr pNzbzIxinedtUvKW9jb08zx8k2tjVat81Ca/mhkkuIIIPb4TRvsySHHputNFUeR6RfBY m1J1wqh5d4W5UU2N0PLmIh0luUh4Q5Vsiuof71CFQzMJXYgibx7svZJ5+eLUlODmZfPG UJkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik22-20020a170902ab1600b00186b1459953si13148760plb.382.2022.11.02.02.41.31; Wed, 02 Nov 2022 02:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbiKBJU5 (ORCPT + 97 others); Wed, 2 Nov 2022 05:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231463AbiKBJUi (ORCPT ); Wed, 2 Nov 2022 05:20:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BEE3225; Wed, 2 Nov 2022 02:18:28 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N2LnT481WzpW9X; Wed, 2 Nov 2022 17:14:53 +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; Wed, 2 Nov 2022 17:18:26 +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; Wed, 2 Nov 2022 17:18:25 +0800 Subject: Re: [PATCH v7 00/11] kallsyms: Optimizes the performance of lookup symbols From: "Leizhen (ThunderTown)" To: Luis Chamberlain CC: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , , , Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , , Steven Rostedt , "Ingo Molnar" References: <20221017064950.2038-1-thunder.leizhen@huawei.com> <77f1c8f0-5e67-0e57-9285-15ba613044fb@huawei.com> <4f06547b-456f-e1ec-c535-16577f502ff1@huawei.com> <712fae84-aadc-7d29-f311-a3352bab6346@huawei.com> Message-ID: Date: Wed, 2 Nov 2022 17:18:25 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/10/31 23:04, Leizhen (ThunderTown) wrote: > Now, we need to make a decision. Choose one of the two: > 1. Continue with my current approach. Improve the average performance of > kallsyms_lookup_name() by 20 to 30 times. The memory overhead is increased by: > arm64 (defconfig): > 73.5KiB and 4.0% if CONFIG_KALLSYMS_ALL=y. > 19.8KiB and 2.8% if CONFIG_KALLSYMS_ALL=n. > x86 (defconfig): > 49.0KiB and 3.0% if CONFIG_KALLSYMS_ALL=y. > 16.8KiB and 2.3% if CONFIG_KALLSYMS_ALL=n. > 2. Sort names, binary search (The static function causes duplicate names. Additional work is required) > 2^18=262144, only up to 18 symbol expansions and comparisons are required. > The performance is definitely excellent, although I haven't tested it yet. > The memory overhead is increased by: 6 * kallsyms_num_syms > arm64 (defconfig): > 1MiB if CONFIG_KALLSYMS_ALL=y. > 362KiB if CONFIG_KALLSYMS_ALL=n. > x86 (defconfig): > 770KiB if CONFIG_KALLSYMS_ALL=y. > 356KiB if CONFIG_KALLSYMS_ALL=n. Hi, Luis: I've implemented v8 based on method 2(Sort names, binary search). The memory overhead is increased by: 3 * kallsyms_num_syms. kallsyms_offsets_of_names[] is not added in v8 because it does not help much in performance improvement, so save (3 * kallsyms_num_syms) bytes. For details about the performance data, please see the commit message. -- Regards, Zhen Lei