From patchwork Sat Oct 22 22:56:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 7953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1385199wrr; Sat, 22 Oct 2022 16:08:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Jn2elUr2IYohnjqT5+J0bQkIqyJjsrLiNjRJ5uQG2QNOGWCPvw9N/QmcEws2nWMpdm0jT X-Received: by 2002:a17:902:c952:b0:184:ba4f:af39 with SMTP id i18-20020a170902c95200b00184ba4faf39mr26233373pla.58.1666480137579; Sat, 22 Oct 2022 16:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666480137; cv=none; d=google.com; s=arc-20160816; b=Gab+TcIS0DuzOG09xlSaJJlk0Osh4L4mNhZVyonjE5ye2J5IeSJia6FRDbwugltpBG 7bNQb4o62cPARkdsOxhzDsXANwSLOve20Xrn8k3bF7zC6tTb3TDjnYi/xyKBt8CHIDOF 2bomh+0nhpvgK3n2woITeisPyNTniyYxDKS2YQ13aG9p1nnYkcjaZw/oM7/XoAD+JJIR i5m3XGV4RUESUsPFTRDyao2dj6ea0+36dCrD/USggkjOpHrnojT3N4lrk818/u630QHI DkKqAi1C1jqO7NSRgWouE4PGrrGDV0g9GHJwXy9SX8dspurl3irJ4cLO8L4dYD12gRPL dA4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ORhdzvQEaSdepN8FuCdBMVAeS8RbuY3+hyzMb2MUCmU=; b=HvKreDsDxoCfGuOOk7FbEVEr+LXFuzKRK1NwDfWMVvUl4MN9BKEXiAOCgnjS5zahVF EVfR3dVBno/UA8OGGaZ+9CS0sMrplN9G347um9EV1xnhbeSBsbwKLzZmawdVrQ8NMUz9 2iAHfiZ4OL8wyn5Fle/2Y59ADz7rD9/ac5ynpBwQy2OCWCOQrITZyRCRYu82VY2STMk2 g/RJIVZsbpWZ32r/PKlG60nTzV85t0/Db47nNN1r198aWxdIlmoInsfhbdvzYGNE4BXL PnRPiW95K8fu7GkfplgQDiQZAguo9wTDa133Q3oJwFGP+lL+9A0QJEUXGVUZMUxIhIHH JjcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=imJjz4YU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk2-20020a17090b4a0200b00205d58e9125si13237132pjb.68.2022.10.22.16.08.41; Sat, 22 Oct 2022 16:08:57 -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=@gmail.com header.s=20210112 header.b=imJjz4YU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbiJVW4x (ORCPT + 99 others); Sat, 22 Oct 2022 18:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiJVW4q (ORCPT ); Sat, 22 Oct 2022 18:56:46 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85B4A83F0E for ; Sat, 22 Oct 2022 15:56:43 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id o13so3476448ilc.7 for ; Sat, 22 Oct 2022 15:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ORhdzvQEaSdepN8FuCdBMVAeS8RbuY3+hyzMb2MUCmU=; b=imJjz4YUqkUgXSc3EF12M37WxP4WbL+hgXoZMK1cg2iq0IzawOyWw6yY0b3M/ycF0F vJOkRIn3dyOuYiVxlWQvdQVaZG7QMG1g5iZwrWS1AZBdA02KGc3R1/7/9Nz0s79qYpZk tNXzRrxkTuAlEnyYwa+ni/w+C6ZQD6NGU55xBypZidVON8hhDa15OoHa+URAmKeAMP18 uE03ABYJ/pv4Y8fZr4byStUEd1jslLOP+73mzSj+BjHUnELns8am5sV7Pe6lOJ/ZaFDX 9JFfsC8NXkQN0kgYYHRWh51m7EZb5uFRFSGgwEnHlBSAGEXaNKjM+p++NUAN9HArfNX5 +R3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ORhdzvQEaSdepN8FuCdBMVAeS8RbuY3+hyzMb2MUCmU=; b=MeWUh+mQxESe4GKebthmWmeToxa3g1DDMWhwGm4j9LJH5AT1zzkwza5eZrLNkfjd7t zGPgPTSefF7wAQ9qxjc2FJwk/tGuyzTt8Mgk2wNec+FeNctesX6GL0GpLHDNuuChEcsf QUetQJBX2hLPdiAx82Sw3R4W4TjhGGDAg4y5ZSwHe8lBocnrLovJITlpiTwtigGBHdNU A70PCEEurZVqA25H6U8xOIPRIWgKieE4I09dgxsBltQceQwQThjMLm3tpy5DAEAgN0lu 2FuXpzJNUsPklTekk23zQlZQ3mxIwE59fhGNZchGKaG4xO3gcQwz5kuvljwdSmDZa4hp rPgw== X-Gm-Message-State: ACrzQf0MC5SextgffhTjCBYvT65OOtytqj+XGwdX4oFPP2wlIoUTYK5J 3s/UUVZWxMY9dCj/zwXA0JPtZaSCgQw= X-Received: by 2002:a05:6e02:1b82:b0:2fa:f88f:7434 with SMTP id h2-20020a056e021b8200b002faf88f7434mr18313844ili.191.1666479401951; Sat, 22 Oct 2022 15:56:41 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o9-20020a927309000000b002fc323a2902sm2492267ilc.62.2022.10.22.15.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 15:56:41 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org Cc: Jim Cromie Subject: [PATCH 2/2] vmlinux.lds.h: place optional header space in BOUNDED_SECTION Date: Sat, 22 Oct 2022 16:56:37 -0600 Message-Id: <20221022225637.1406715-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221022225637.1406715-1-jim.cromie@gmail.com> References: <20221022225637.1406715-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747431076776051897?= X-GMAIL-MSGID: =?utf-8?q?1747431076776051897?= Extend recently added BOUNDED_SECTION(_name) macro by adding a KEEP(*(.gnu.linkonce.##_name)) before the KEEP(*(_name)). This does nothing by itself, vmlinux is the same before and after this patch. But if a developer adds a .gnu.linkonce.foo record, that record is placed in the front of the section, where it can be used as a header for the table. The intent is to create an up-link to another organizing struct, from where related tables can be referenced. And since every item in a table has a known offset from its header, that same offset can be used to fetch records from the related tables. By itself, this doesnt gain much, unless maybe the pattern of access is to scan 1 or 2 fields in each fat record, but with 2 16 bit .map* fields added, we could de-duplicate 2 related tables. The use case here is struct _ddebug, which has 3 pointers (function, file, module) with substantial repetition; respectively 53%, 90%, and the module column is fully recoverable after dynamic_debug_init() splits the table into a linked list of "module" chunks. On a DYNAMIC_DEBUG=y kernel with 5k pr_debugs, the memory savings should be ~100 KiB. Signed-off-by: Jim Cromie --- ? does this need a new name ? HEADERED_SECTION ? --- include/asm-generic/vmlinux.lds.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 9f6352171f88..b3ca56ac163f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -195,11 +195,13 @@ #define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _s_, _e_) \ _s_##_label_ = .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ KEEP(*(_sec_)) \ _e_##_label_ = .; #define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _s_, _e_) \ _label_##_s_ = .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ KEEP(*(_sec_)) \ _label_##_e_ = .;