Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1248204rwi; Wed, 26 Oct 2022 12:42:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Cfl6CPg/kTfF+xYMomd4Pb1feYJfxKd60qaaibDMQXKm5ZVMUTHrHbj2NI0/t8vIQqw10 X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr33601648ejc.474.1666813343706; Wed, 26 Oct 2022 12:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666813343; cv=none; d=google.com; s=arc-20160816; b=x7t+mPsbAmNNgsgfcmvVaotVj+GU1TcVj31hJ/l5dD9u/Xn+Y5+UhAczCIc4rcwMWj xIbzBLpk7qoN4Fx11niayALUFP1BVJ263qPGAbrdkXHCGjEn2HyEzdWTYevOWFZYjajN BDhxPJqIV9Ksr4mOmlHaWoPX/G0eNJelyfktY0NRDYVBx6aj4KEPlJIdFBetuYGUaiVr ABz0vIvQDNRJAyq5ZRZJAWGvqVQ87y8iXTTv/FQJ7RiFHgDTuPPqCp5BKxSVF4pSlvtG DCGJE+y/9rhOKlavqKWgO17CBicDhN2nHUbgpBeRo1jwRG6WcYiTMXcvyfhh2d7RE3Lg 8PPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=r3Pfzq8iLf21/gz3vKU7KH69j7rAkB4oAHyVkIHhiQY=; b=CD+C4NOCuhpm5P9JYGaUoZkOug0ppnT4Zc6i5bOf4a6/Qmpr+h9jbJsTioLaMdOQi4 rvFPKKvRUqxD2Fc7BDoREI+VBVGOZvVk619ADayFHjy+Vy1xbL3SoCgsFDWLApCUuVHJ Off/5gSKLYPTiev7XdwyT9RklHYVATM44pn1V8SPJQYaKjZrx93ZATbsom781czdPR9O 1qpuPgKnLjaFm6BAJ7edBiJrWpzvyWGtGcArz1cQK0G3SpEC2Ef2gIHZveEgdCz16dWa q6TBFtpc1nq3y3MigfcSIa+zo36M50LFitNDRGgl9ftioooeFLC9sv8baSeP2VVcPEys CNrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=xF+2rcJB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he32-20020a1709073da000b0078e19e971b2si5674423ejc.915.2022.10.26.12.41.57; Wed, 26 Oct 2022 12:42:23 -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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=xF+2rcJB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234793AbiJZTG4 (ORCPT + 99 others); Wed, 26 Oct 2022 15:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234528AbiJZTGh (ORCPT ); Wed, 26 Oct 2022 15:06:37 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113AF141383; Wed, 26 Oct 2022 12:03:47 -0700 (PDT) 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=r3Pfzq8iLf21/gz3vKU7KH69j7rAkB4oAHyVkIHhiQY=; b=xF+2rcJB7udh+J+Ag+JT79VckR 5/aeywQviRtPSnZ1ya9NT5lSAPGHHA9rhIJHo+Mt4EvVqNvp16GSByh4l3YA9wr8mnJzJlGr0jCNb uc39VCS4doPpfNlfEzYYzd4AJkxMzm2sl++QAN6ALwLoz4CuzlvQH4V9bO9UxEPW/Mha+7kDNixxS aIPz0NPwzTOrk56hw0Un20+nzgGcVR3U7I5bS7KX7GDsvt+tKFrYomWjZehL+775+fzIPKyCRurCd l8ddecgsWb6qqaZy2vUq7BcVpJtQHOeWC3pdyvillVYqjLFfj8sFJnT2gwkfY8rwDK6pv0ikz65Js jjZd+1yQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1onlge-00Aer3-5w; Wed, 26 Oct 2022 19:03:36 +0000 Date: Wed, 26 Oct 2022 12:03:36 -0700 From: Luis Chamberlain To: "Leizhen (ThunderTown)" Cc: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , linux-modules@vger.kernel.org, Steven Rostedt , Ingo Molnar Subject: Re: [PATCH v7 00/11] kallsyms: Optimizes the performance of lookup symbols Message-ID: References: <20221017064950.2038-1-thunder.leizhen@huawei.com> <77f1c8f0-5e67-0e57-9285-15ba613044fb@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77f1c8f0-5e67-0e57-9285-15ba613044fb@huawei.com> Sender: Luis Chamberlain X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 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. Luis