From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=212.77.101.9 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794917528; b=23A9LjTYDV3t/9sDkzl0mcWnKTiBTIvqsNUCFmDzApqo2FAgMB2ZpyGXQWiPsuO2b+qi g/tQL/ZxXMsD1Yoj2S+5iGtBr87v+mbSGtCSHSj0/2frsPctVd5WFroQFOUAfGYIeNv2U pGW4APVj2PrFbwVSorT5gtNVp0K9sO9TH/0U2eG7us2R5RT/byjt6BQcrChzJI/f1AiSo SfrfwQ+UatYE2WrbXAoquGDDgWYz851CLhPNueKKpxD4Ij2LOLpxummOU17cCRYvbO+ej f68J4pu7VhZbwQIEcn9GSClvwpGq37WbOMeJMa3d5iUGbfBe6AazU6M6sD2iPycfKLg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794917528; h=DMARC-Filter:Received:DKIM-Signature:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-WP-MailID:X-WP-AV:X-WP-SPAM; bh=lj9OagPSRJNvuPdGLWpYCPjIPPY/8eEyHeaFsrygvcA=; b=MraFZQoGIuqDyh3S0Wnr/iYFzTm9onEg2pDyLkN9TI+p25dYR19bEDjnXCzDroVutVkT KheV0xQF6zr8D1PFQiWAU/xNZJCOQJiHlFBkFgWR8QRu0MWwz7NFtqeGvTegtLxD56wXf RvZHxV/pVt/vi08OkrzMRYEECo0tT+eAKBFDSniAgr0I9gnoZ75+dYWYRpTLOGWjzAl5s TW3hj2HNuDEOv6+avY7OqLn0JCOp8AoQpz18eq46taZQHRm6+Lg1dnqiS01kmSm8gNjuz JGTcMEJmAArHetfDBLVxVaVM3g4Vz3UwXi83QsR4LnIKQxa5krEgIxT1eHpRTE2d7vw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=wp.pl; spf=pass smtp.mailfrom=wp.pl; dkim=pass header.d=wp.pl header.i=@wp.pl header.a=rsa-sha256 header.s=s20261001 header.b=jlgRi2Cz; arc=none smtp.remote-ip=212.77.101.9 Received: from mx3.wp.pl (mx3.wp.pl [212.77.101.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1DC4606A329 for ; Tue, 17 Nov 2026 12:12:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D1DC4606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wp.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wp.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wp.pl header.i=@wp.pl header.a=rsa-sha256 header.s=s20261001 header.b=jlgRi2Cz Received: (wp-smtpd smtp.wp.pl 8210 invoked from network); 17 Nov 2026 13:12:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=s20261001; t=1794917525; bh=lj9OagPSRJNvuPdGLWpYCPjIPPY/8eEyHeaFsrygvcA=; h=From:To:Cc:Subject; b=jlgRi2Cz/vVIwgREakUwVS49sHWLB7aN7h7CfhjIj8hgRoJdvFDpuemdEJaaQWwiy dv6H+g5JUTUe7bna0U+ZEuLGGD3ivvaHT5aYkCLA37aVE0naYwhKWc+fMGMbJqvn4n OY3PoxhoDsCkSAYYOx9wcabMT+LCqb6fRUmuLcF0bgz7bhUcmZa39D2UcyEuFwKdBj gnKIWHao6SFiQh4sbj97f1n7eF9nY1RfajMxe/2eXHHo4MfMt0g85h6FC4grEYgvBz +MT/z8JqAEQJ7MKF8RGMb5Rb7h/bmkkGJjN+aLVkyklihZhinWd3LFhUgRN4GYKugV GP2gKmLvNH+aw== Received: from localhost (77-236-5-223.static.play.pl [77.236.5.223]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with TLS_AES_256_GCM_SHA384 encrypted SMTP for ; 17 Nov 2026 13:12:05 +0100 Date: Tue, 17 Nov 2026 13:12:04 +0100 From: Stanislaw Gruszka To: Petr Mladek Cc: linux-modules@vger.kernel.org, Sami Tolvanen , Luis Chamberlain , Petr Pavlu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.org, Daniel Gomez , Aaron Tomlin , Steven Rostedt , Masami Hiramatsu , Jordan Rome , Viktor Malik , Miroslav Benes , Josh Poimboeuf , Joe Lawrence Subject: Re: [PATCH v2 2/2] module/kallsyms: sort function symbols and use binary search Message-ID: References: <20260327110005.16499-1-stf_xl@wp.pl> <20260327110005.16499-2-stf_xl@wp.pl> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-WP-MailID: 53ea68bc8316ef981b297076ee5d6f3b X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 000000A [sTNU] Hi On Tue, May 05, 2026 at 02:24:41PM +0200, Petr Mladek wrote: > 2. Livepatches _rely on the sorting_ of symbols in the module. > The special relocation symbols might define a symbol position, > see > > .klp.sym.objname.symbol_name,sympos > > in the documentation. It defines the position of the symbol > when there are more symbols of the same name, see > klp_match_callback() in kernel/livepatch/core.c. > > I am afraid that _this patch might break_ this when it moves > function symbols before non-funciton ones. I guess that > the symbols of the same name will not longer be groupped. Thanks for pointing this out. It took me quite a while to understand the issue, but I finally got it. > Idea: Is the shufling really important for the performance, please? One reason I wanted to shuffle the symbols was to also speed up name-based lookups, assuming that most lookups are for function symbols. Moving them to the beginning of the table reduces the number of entries that need to be scanned in the common case. In my benchmarks, this reduced the average time spent in __find_kallsyms_symbol_value() from 16 us to 6 us. > I would expect that binary search would have a good performance > even without the shuffling. It puts aside half of the symbols in > one cycle. I'm now going with a separate sorted index table, leaving the original symtab untouched. I think the name lookup optimization could be revisited later by introducing a new function that uses the index table to search only text symbols, where appropriate. Regards Stanislaw