Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3364994rwl; Tue, 27 Dec 2022 08:07:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXsAQNwVMPqdf8tfyg5TS7E+T/bAHdpSPVb7c7Ts1jlHVS4HyfYM55hQuIVAatsQrfxwROPw X-Received: by 2002:a17:907:8c81:b0:7c0:7d35:e9db with SMTP id td1-20020a1709078c8100b007c07d35e9dbmr27043159ejc.15.1672157222872; Tue, 27 Dec 2022 08:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672157222; cv=none; d=google.com; s=arc-20160816; b=uLD8vFDjrxsSgf6iQbvtqDavD0X3TuSeyNKVNtz9F6hJVVl4Jo9SHSGZ6cO2Q+ZZ4r QjM5xQF+8EXRkjgy3hcIigLQOKni7moKWXHJXA9yzC3thlfiqNMUZwWqYHNciRqkQzcC h0QShC7h/wa4/rTrqwem3UOJqnUGtcST1Twb9oAQZICPg9S/Ut2rEgfDVfTbBugJ7K+i efGIjrvJhEyK32wC8V19VEEgOxzKqpQzJ8X2UHEuQUf1Y283Qbfql+WIpEJDbZsxi5W3 EIZCuousEC8BCuL19ZujBrypkcLtmqFzVTCPuOW0ZsJO9Cm3VFQopioQcYZ2MOp5orjm 6noA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:dkim-signature :from; bh=T7ji34dxrZIYtvle5TFEDTXCtcXG1bgiku7DLfmLysE=; b=OonOM6s2jvE7H8nomXlsBl0sOf3mDeXUbQP7zcDcwNQ94n9XwMslVwuNURwOv5/sPe +kvWhEh+aptELQAdJNdoANH2sA569zimFnznCk267q5V1IrKFWibh3WQ9gIrkki7NUUZ 0/QJqMzBAtpBCwAq9JXMDRqLTjrMgWU9zHNfj2QkVDprMk4NT8yoKMe1OtbaWNAQWM/6 gopHBxl5fOctKw7tscp0a3FxrV46ZgMC9xngYiG6oaLWACpf0Tz/sWMP9LT7mllk8v+W EhrZZLFWtSyD2DvzYvFrAZFucKBiVHY0+GQplgckEOq9xtiF5bKzBrVPWork95sF7Zek b4aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=EiXUPHGF; 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 nd16-20020a170907629000b007ae0fe6198fsi12953019ejc.132.2022.12.27.08.06.47; Tue, 27 Dec 2022 08:07:02 -0800 (PST) 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=fail header.i=@weissschuh.net header.s=mail header.b=EiXUPHGF; 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 S232081AbiL0QDM (ORCPT + 66 others); Tue, 27 Dec 2022 11:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231593AbiL0QCv (ORCPT ); Tue, 27 Dec 2022 11:02:51 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9A60EA9 for ; Tue, 27 Dec 2022 08:02:49 -0800 (PST) From: Thomas =?utf-8?q?Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1672156966; bh=gxt7wUGYdqW5dnnuQ+NaxVEhN/M72u1992lthLjmCpQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EiXUPHGFDmtPI7cJe3auCz78QEZVKKF7TJace5j4pwj6zMPPa/GLrAThg8QRf45cb CRiY80s8+sLJ68Ia20SlXixIMUM3zT613FRFkUsFCDPdOkxURh1dpVKZVBIdgs0WV6 /f+FEcehsMWpRxT0eX3prW9HW6suMy5Mn2qVygQ4= Date: Tue, 27 Dec 2022 16:01:02 +0000 Subject: [PATCH v2 6/8] objtool: optimize layout of struct symbol MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <20221216-objtool-memory-v2-6-17968f85a464@weissschuh.net> References: <20221216-objtool-memory-v2-0-17968f85a464@weissschuh.net> In-Reply-To: <20221216-objtool-memory-v2-0-17968f85a464@weissschuh.net> To: Josh Poimboeuf , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Thomas =?utf-8?q?Wei=C3=9Fschuh?= X-Mailer: b4 0.11.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1672156865; l=1055; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=gxt7wUGYdqW5dnnuQ+NaxVEhN/M72u1992lthLjmCpQ=; b=Xsvfu2//FCigo7nfKlub7bHkejf0HGMpbq3HbjfGca8mWRf746ZswAaDkqiJvr95RiP3HIyPAfT+ BjLuHeGpBnQGqMsq+1ETS/WYtzPaT8s4r8ITG7PGAXEO+6sixRQ4 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Reduce the size of struct symbol on x86_64 from 208 to 200 bytes. This structure is allocated a lot and never freed. This reduces maximum memory usage while processing vmlinux.o from 2919716 KB to 2917988 KB (-0.5%) on my notebooks "localmodconfig". Signed-off-by: Thomas Weißschuh --- tools/objtool/include/objtool/elf.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index 2b5becad5a0a..f41573ff1f8b 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -50,12 +50,11 @@ struct symbol { GElf_Sym sym; struct section *sec; char *name; - unsigned int idx; - unsigned char bind, type; + unsigned int idx, len; unsigned long offset; - unsigned int len; unsigned long __subtree_last; struct symbol *pfunc, *cfunc, *alias; + unsigned char bind, type; u8 uaccess_safe : 1; u8 static_call_tramp : 1; u8 retpoline_thunk : 1; -- 2.39.0