Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp90831rwi; Wed, 26 Oct 2022 21:11:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XP/GqIe5/wTVWcp7rgIOBJA0s5DKkIbT0T8aJcYcYvQ4kLopjh/FIwnwAW+PyXWLsXHwg X-Received: by 2002:a17:90b:4b89:b0:20a:c168:6865 with SMTP id lr9-20020a17090b4b8900b0020ac1686865mr7945569pjb.130.1666843899285; Wed, 26 Oct 2022 21:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666843899; cv=none; d=google.com; s=arc-20160816; b=eiid+XqkBusB9PpAS4kFMCaK2wvtwERHX60L5PvxbAbaU5/rrYlMQCqJhK6AczBw81 7+2QTeWyfRr0Nkajrl9nHd7bmTu6mJ1kbpIrQKgrL4SU2OE0M0iZCAi67MVyY/jwTUq9 HxAxdwYWl1nA3/XoKXsH3fhpGZP6gipJdzpiE23O2nb/u7xtb0bPUnslMVwCLCe2wUMM s4/YEDEEBmzeBuwdpUM7kC6HzEuWqpSunOXalOJK8bJvCsx/CDu/eCbfMM6plQUHiMqi HwNJUiTD8gwFW5t874qxGsb/qBE3RR0YqtupiUzUGBU2/O8N8pEUOfgcu3HoZha/7i+t YnsA== 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:from:references :cc:to:subject; bh=C2POUU7yBagWNx4/VTNkEPKsQjMT7i9V+eB1OA0Wk4M=; b=DCzsoXlhfJSFUgg3cSLP/GYYSShX7q3pTjDmZk26LjstX6zpSzokkUABKP7q6UsS6j hFnpyD2/yjuJHJOrqb1b+gjE0pnBXrx1+xSwU7vWI4eYyZcnoDIj34aNrP4kFkDHNK4K DRuTfR6ZP3TozRcg4a+TLQg7IKHLWT1IFnQFscIzBOXW5b4QL7ZfpG6OjZT0JVSzjX2s nnGFDnTqnoqCrRGAGakOYKjxbMObSStUfaG6oc7BGsULbaO1a2Zo6i+WvR5gfROLNYd+ TvvamaOMy78evJBUUcNOw9ZyX90ygwe6GIzE5HdStHwc2QPTipukW09sz0vMe5m2KHkF 59fg== 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 e4-20020a17090301c400b00186b9b292bcsi392689plh.2.2022.10.26.21.11.28; Wed, 26 Oct 2022 21:11:39 -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 S233585AbiJ0D0R (ORCPT + 99 others); Wed, 26 Oct 2022 23:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbiJ0D0O (ORCPT ); Wed, 26 Oct 2022 23:26:14 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76DF54D828; Wed, 26 Oct 2022 20:26:11 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MyWDB4mkPzmVY0; Thu, 27 Oct 2022 11:21:14 +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; Thu, 27 Oct 2022 11:26:08 +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; Thu, 27 Oct 2022 11:26:07 +0800 Subject: Re: [PATCH v7 00/11] kallsyms: Optimizes the performance of lookup symbols 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> From: "Leizhen (ThunderTown)" Message-ID: <4f06547b-456f-e1ec-c535-16577f502ff1@huawei.com> Date: Thu, 27 Oct 2022 11:26:07 +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: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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/27 3:03, Luis Chamberlain wrote: > On Wed, Oct 26, 2022 at 02:44:36PM +0800, Leizhen (ThunderTown) wrote: >> On 2022/10/26 1:53, Luis Chamberlain wrote: >>> This answers how we don't use a hash table, the question was *should* we >>> use one? >> >> I'm not the original author, and I can only answer now based on my understanding. Maybe >> the original author didn't think of the hash method, or he has weighed it out. >> >> Hash is a good solution if only performance is required and memory overhead is not >> considered. Using hash will increase the memory size by up to "4 * kallsyms_num_syms + >> 4 * ARRAY_SIZE(hashtable)" bytes, kallsyms_num_syms is about 1-2 million. >> >> Because I don't know what hash algorithm will be used, the cost of generating the >> hash value corresponding to the symbol name is unknown now. But I think it's gonna >> be small. But it definitely needs a simpler algorithm, the tool needs to implement >> the same hash algorithm. > > For instance, you can look at evaluating if alloc_large_system_hash() would help. OK, I found the right hash function. In this way, the tool does not need to consider the byte order. include/linux/stringhash.h /* * Version 1: one byte at a time. Example of use: * * unsigned long hash = init_name_hash; * while (*p) * hash = partial_name_hash(tolower(*p++), hash); * hash = end_name_hash(hash); > > Luis > . > -- Regards, Zhen Lei