Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4902289iog; Wed, 22 Jun 2022 08:01:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7Vo+otFlMPNpsQicwGFGNBrS5y0IauPG+75si9K0r1JIL4hDVmnLY+50KublIqCD94fCz X-Received: by 2002:a17:907:1b20:b0:6da:649b:d99e with SMTP id mp32-20020a1709071b2000b006da649bd99emr3492485ejc.712.1655910078564; Wed, 22 Jun 2022 08:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655910078; cv=none; d=google.com; s=arc-20160816; b=uKDOzxj51gSg7sP6wys+jYcKyCmyu+YsSfVhYxJMCplGT7MIFcsWy/n54VcT4jAIsB y6PQdR54vhacnLTDlZmjcuIzB47KaFO7w5LsZHuVvodu3lFdc+Y6BADSUwP4yCgwH38u jmMR9pQh0ATkG1sV9cX22LIPJpEMJGZVprjHJi6qZ/6cE+LEkp7924xBG1ky3ew7Fm9c Dp9FSEU9IZnTGo7j3aREZtpY3LJULuFgBPD+Gq3YgUwH/uL2YQB977NUyH18zh/4rKPf o+sT5FUL/r5rKe2z9KDPRV1275+IZn8QZmUqUffCFV+zNzlHzc5+D093DXWMsp4abCKR XR8A== 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:subject:cc:to:from:date; bh=e+mXYY8//O6VSS5fjQJbZtsDd40Drjs9hh0TC2mXRFw=; b=Mt5lTAPM5zPP/2WyFNFXJqMgmAIBZzwZo4K8s8/xod0JoJrPZK0YZQr/XY1em2xxGK 9MQ+crMnaroK+jCKyNqExca0K9F7UEGjqKvl5WRWSr/eaANDj3vn8MOK0O5PlGOjhaMJ kvR5gauNY5eZB//f/n3dtGyuLdKYhHN3WVhXDqKZPaR+9xvSeNibAqVUKP/wma4y9HqX OhpTWnRk5sfbmH4WIr9IOTIHSlYkyZ2Pa0Si8yVx2Tjbqq0nF1+BPsO3yTQdZN3IawBR ea6v0M7LhT1Mxufu2IJ4Bu06YthgU0lwKIh0LOS1MSLrRoGkaYHWSIsawBAR3BhiE9TZ hvfw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bt4-20020a0564020a4400b004356afc7003si14241826edb.169.2022.06.22.08.00.52; Wed, 22 Jun 2022 08:01:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358381AbiFVOvH convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Jun 2022 10:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358301AbiFVOuo (ORCPT ); Wed, 22 Jun 2022 10:50:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CE823E0ED for ; Wed, 22 Jun 2022 07:50:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 289056194B for ; Wed, 22 Jun 2022 14:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB600C34114; Wed, 22 Jun 2022 14:50:19 +0000 (UTC) Date: Wed, 22 Jun 2022 10:50:18 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , christophe.leroy@csgroup.eu, naveen.n.rao@linux.vnet.ibm.com, mbenes@suse.cz Subject: Re: [RFC][PATCH] ftrace,objtool: PC32 based __mcount_loc Message-ID: <20220622105017.04630f12@rorschach.local.home> In-Reply-To: References: X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Fri, 17 Jun 2022 13:24:53 +0200 Peter Zijlstra wrote: > Hi, > > I recently noticed that __mcount_loc is 64bit wide, containing absolute > addresses. Since __mcount_loc is a permanent section (not one we drop > after boot), this bloats the kernel memory usage for no real purpose. Wait, it's not dropped? Nothing uses it after it is read. It should be dropped when init data is dropped. From include/asm-generic/vmlinux.lds.h /* init and exit section handling */ #define INIT_DATA \ KEEP(*(SORT(___kentry+*))) \ *(.init.data init.data.*) \ MEM_DISCARD(init.data*) \ KERNEL_CTORS() \ MCOUNT_REC() \ <<---- *(.init.rodata .init.rodata.*) \ FTRACE_EVENTS() \ TRACE_SYSCALLS() \ KPROBE_BLACKLIST() \ ERROR_INJECT_WHITELIST() \ MEM_DISCARD(init.rodata) \ So it should be dropped after boot. -- Steve > > The below patch adds __mcount_loc_32 and objtool support to generate it. > This saves, on an x86_64-defconfig + FTRACE, 23975*4 ~= 94K of permanent > storage. > > XXX hobbled sorttable for now > XXX compile tested only >