[tip:,locking/core] locking/lockdep: Slightly reorder 'struct lock_class' to save some memory
Message ID | 170107520853.398.5812171619911841670.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2946185vqx; Mon, 27 Nov 2023 00:53:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/Yfu3nSWIXeWCIW6weaKuYjNymQ/3TwD/fwSuwX5jxkbuPSvNGQ/0FU3LXiJdWXYJzddP X-Received: by 2002:a17:90b:3a8b:b0:285:cc9c:75f8 with SMTP id om11-20020a17090b3a8b00b00285cc9c75f8mr3297591pjb.1.1701075224597; Mon, 27 Nov 2023 00:53:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701075224; cv=none; d=google.com; s=arc-20160816; b=TxB5Itu/WUI4Wc/C2JtQ+9/4tDOKVbMdwkxf0AWsN1wHYNyHwU0wZIbTc4bTQrj4Uc G9fwzKP/oWNEjP3y7leUrXXJvrnsQs3nBiBE3+BfCesudmxz/S8r+5qHSgGYskGdjlLs CsAbmQ2NyUUpjH0sAIasfU8JtBt8Ra9806Sz/CSS+YPAS+4f+odkPdOl+LmCSf9A0hoL mGDeREJV31nJRBqP6G7THhuazmtBtrWsGBNaFbIehcub8BwTctW8BgRTyCKg1SDqZZp6 6Dp5l1rKP9y/KohqMqvVaqPE3eIbc4d8I8Ca4/ba6HuRO2fK66qVFZUvGqA0+gKRBg7j G1pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=CHN5isM16XvAh/O16p6UY2UrydXWXhGG5EHOuvXB+54=; fh=43qifNvsvIMlwk4v2EOw4clJOkE1NbXwnJuB8wU6MBI=; b=ROlFzPDrbe8o2QjrAi2HwnvKQzzD/GGu8XRy7RnJrSo0/a3f7B/thN4U2iJemDcR18 IjsmbZirrqVgtOF1ilorVUXmk6EcHhq0ae2OZLRmLFfLLbzcwLrlSptGXDtIQwsS61YK e3Y6p8kIenrqd24D4zR9h4jxH1VKx/laP+D7YP+DJEjiAF/fYtiVB7ODBKtBnjBb0Y8E LruHzNtVHhUt/+VCKy+lyridfpMFankwvMXugl10/e2s29SExtZE/v5EvnBtKoeEiXhY hEUDMvkbhOlYRnK3p/18sashXnQe0kg0HlEisNlzUQeJHwCdFM0azDGOGOp0hzcjucrv iTyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MtQMJ1H6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=dwht2BZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id hg17-20020a17090b301100b0027d4684804dsi9089180pjb.122.2023.11.27.00.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 00:53:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MtQMJ1H6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=dwht2BZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E3011808EEDE; Mon, 27 Nov 2023 00:53:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232616AbjK0Ixa (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 27 Nov 2023 03:53:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232620AbjK0Ix1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Nov 2023 03:53:27 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BFC1AD; Mon, 27 Nov 2023 00:53:32 -0800 (PST) Date: Mon, 27 Nov 2023 08:53:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701075209; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CHN5isM16XvAh/O16p6UY2UrydXWXhGG5EHOuvXB+54=; b=MtQMJ1H6a2LdOMsJJNFDx+X0wIfob1Wf3M7UNk37OZ1V6GNWb4MqgkGRgM2elBC8cNqMNe 7O6qhes0/CoMu1SuFsvnVMzLlLxDxlqlGM5prwNBo64gdueolhQBvLJcVhFD5+qFdwqUfx VbyVIX/Au3kjhmDFcsvsL6IHlGBkoCOVa0AmrzIa1vO65Y8O3pHKelUwp/U7EnFiDJNPTL pvtCf9zCcFjO/j0vcqMZV6Hyl28jU9NAP7x6lUc1poQfJe2kGAbKwWsuPueQ98tQTFSRYK MAAk/gkcStajqEiuRTzgW2jHGbhGXQTGId559LfJB0c8Ple8u6HvYNXgJhxa8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701075209; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CHN5isM16XvAh/O16p6UY2UrydXWXhGG5EHOuvXB+54=; b=dwht2BZCsIGKQxzbLxnVHi6/b6j2Xc3MyKMnyEcI0dK3UUIhZM6h08q8+bDMmKQcYe1R1s GvttdcmQDxFmcFBg== From: "tip-bot2 for Christophe JAILLET" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/lockdep: Slightly reorder 'struct lock_class' to save some memory Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>, Ingo Molnar <mingo@kernel.org>, Waiman Long <longman@redhat.com>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C801258371fc4101f96495a5aaecef638d6cbd8d3=2E1700988?= =?utf-8?q?869=2Egit=2Echristophe=2Ejaillet=40wanadoo=2Efr=3E?= References: =?utf-8?q?=3C801258371fc4101f96495a5aaecef638d6cbd8d3=2E17009888?= =?utf-8?q?69=2Egit=2Echristophe=2Ejaillet=40wanadoo=2Efr=3E?= MIME-Version: 1.0 Message-ID: <170107520853.398.5812171619911841670.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 27 Nov 2023 00:53:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783620328907103598 X-GMAIL-MSGID: 1783706654804290560 |
Series |
[tip:,locking/core] locking/lockdep: Slightly reorder 'struct lock_class' to save some memory
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Nov. 27, 2023, 8:53 a.m. UTC
The following commit has been merged into the locking/core branch of tip: Commit-ID: 18caaedaf4c3712ab6821f292598a8f86e6d7972 Gitweb: https://git.kernel.org/tip/18caaedaf4c3712ab6821f292598a8f86e6d7972 Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr> AuthorDate: Sun, 26 Nov 2023 09:56:29 +01:00 Committer: Ingo Molnar <mingo@kernel.org> CommitterDate: Mon, 27 Nov 2023 09:46:52 +01:00 locking/lockdep: Slightly reorder 'struct lock_class' to save some memory Based on pahole, 2 holes can be combined in the 'struct lock_class'. This saves 8 bytes in the structure on my x86_64. On a x86_64 configured with allmodconfig, this saves ~64kb of memory in 'kernel/locking/lockdep.o': text data bss dec filename Before: 102,501 1,912,490 11,531,636 13,546,627 kernel/locking/lockdep.o After: 102,181 1,912,490 11,466,100 13,480,771 kernel/locking/lockdep.o because of: struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; After the reorder, pahole gives: struct lock_class { struct hlist_node hash_entry; /* 0 16 */ struct list_head lock_entry; /* 16 16 */ struct list_head locks_after; /* 32 16 */ struct list_head locks_before; /* 48 16 */ /* --- cacheline 1 boundary (64 bytes) --- */ const struct lockdep_subclass_key * key; /* 64 8 */ lock_cmp_fn cmp_fn; /* 72 8 */ lock_print_fn print_fn; /* 80 8 */ unsigned int subclass; /* 88 4 */ unsigned int dep_gen_id; /* 92 4 */ long unsigned int usage_mask; /* 96 8 */ const struct lock_trace * usage_traces[10]; /* 104 80 */ /* --- cacheline 2 boundary (128 bytes) was 56 bytes ago --- */ const char * name; /* 184 8 */ /* --- cacheline 3 boundary (192 bytes) --- */ int name_version; /* 192 4 */ u8 wait_type_inner; /* 196 1 */ u8 wait_type_outer; /* 197 1 */ u8 lock_type; /* 198 1 */ /* XXX 1 byte hole, try to pack */ long unsigned int contention_point[4]; /* 200 32 */ long unsigned int contending_point[4]; /* 232 32 */ /* size: 264, cachelines: 5, members: 18 */ /* sum members: 263, holes: 1, sum holes: 1 */ /* last cacheline: 8 bytes */ }; Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Waiman Long <longman@redhat.com> Link: https://lore.kernel.org/r/801258371fc4101f96495a5aaecef638d6cbd8d3.1700988869.git.christophe.jaillet@wanadoo.fr --- include/linux/lockdep_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h index 2ebc323..857d785 100644 --- a/include/linux/lockdep_types.h +++ b/include/linux/lockdep_types.h @@ -127,12 +127,12 @@ struct lock_class { unsigned long usage_mask; const struct lock_trace *usage_traces[LOCK_TRACE_STATES]; + const char *name; /* * Generation counter, when doing certain classes of graph walking, * to ensure that we check one node only once: */ int name_version; - const char *name; u8 wait_type_inner; u8 wait_type_outer;