From patchwork Thu Nov 16 11:25:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 165770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3141773vqg; Thu, 16 Nov 2023 03:26:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwoCdx+2jwUI8kWL+/Ja9DDGi9/Br1kgZYGOfQLm2lFhIInrFHMWItBjwEICwtL9aEWAvr X-Received: by 2002:a05:6871:82c:b0:1e9:8885:b537 with SMTP id q44-20020a056871082c00b001e98885b537mr17259018oap.41.1700133978258; Thu, 16 Nov 2023 03:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700133978; cv=none; d=google.com; s=arc-20160816; b=TgeDOn2p1NbDev6bDR8lTQOtwdyJiyIEmnIBr2KxPr8cIC8817cAey1wqoI1jVFaBn UCxJ62yjVDq1oIBP/kptQXVLf2xkjDgQ2ydM4Ya65mImZNK942E3RFgbXs/Eu5WNNOQJ yfEARJUlr0tNYFRP2Kfdo44oLfvZp5Nlg7fwtvbxzoU4NadZHB83VB1jSQS6A/wV5Rhs vUEWRd3H97bW/TMFSanDvecdVU0xX5NQcMfHhd8AEDR06hCyDQ+jdOMjKn39lVxJnrPs 7jUR7zFqPNAc545Ill4grJtJp4QYg2SGkq41HnOtue8Nv1uyYKst1NvZ7mw79JhYxgsY qjtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=1YX8Ma5KZ+r8tu/EL90pFa7sq/MQQuAqGo7t9/vWh4o=; fh=HE2wJXftT8wTJoUbEIMaAfMQRs3pkFE9U49g7sE+aiA=; b=Y8XR+lnGpKju/kbuoytl+aY62AGp5Swq2V3mohBf+zM/boLG9NXVQW5/Paas9xl6qN 5ZP5jLSp8sEJeWg2Zp82eT2xetU+9ne944GEJ6Z1T1G+PMmBEe7jUq0vheG0Ep9L7GKl 8hzhrFQJH7DqsGGBHQeiOf38q6zEljULPGh2ijndMK2DTRebgn1G1ga1bMGDCLEt9D+b iH+VGutDy/y0aH2gvhvMao0kPRd4zlW37eoIkj0iLbf1W1fg9KA2hTmRnxB36t6oNFdb 9JuU+brljh3a36FqWM8OACOx0lLlXNDIvNuF0KiK0rteOR6hGhRTPdjG7sVQM8Aff/6P zuuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h6IWRuMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id l189-20020a6388c6000000b005b8eaeabf49si12400736pgd.178.2023.11.16.03.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 03:26:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h6IWRuMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5F7888025DE3; Thu, 16 Nov 2023 03:26:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345233AbjKPLZz (ORCPT + 29 others); Thu, 16 Nov 2023 06:25:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345253AbjKPLZo (ORCPT ); Thu, 16 Nov 2023 06:25:44 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4549DD5E for ; Thu, 16 Nov 2023 03:25:39 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32f737deedfso476328f8f.3 for ; Thu, 16 Nov 2023 03:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700133937; x=1700738737; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=1YX8Ma5KZ+r8tu/EL90pFa7sq/MQQuAqGo7t9/vWh4o=; b=h6IWRuMOdAw7ibiv4mDnmIhzU2TgCMrq4eAvysZnU1ALvcCu6ymcHc+ZmsWPUFxXDf IKE3MiQ0XNAQSVbLVlm4f/VXQHEUykuyZnHHQTTh3Opak56ml3xSfv65TGCxnlW/e2rB F+o6+MKn3j9IA308UEmB/GuV5uvlhXSx1bHyBTm9A9tE+BVH8J78l/xh9o600nZAKAUL ehB0u2IWy9UpPX9Zs8i0rVahhI1tyX80blImX/8pdqS8cRNfT/mGCCfi9SkBU+54p0BX XgdFoP2Q/JEehHOYjbFTEfVQa2Ex2t/4RYnXgvES08yosP9N2yVgqiDORkl88Fp5Kd3I X8ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700133937; x=1700738737; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1YX8Ma5KZ+r8tu/EL90pFa7sq/MQQuAqGo7t9/vWh4o=; b=ru/2d0pV6Qb1U95BBss1hr0mo5FTq52lGgPzMHnl63kIWHd/ynZBZ26wmp1UHlr4/4 T4cRyUtXWVIlNktbZ2h7b19rZz16Vauii6ySNMLTakobV0LWhKlrXFBySB8f2ZaCT9ro bdqSz09FVWIVEHYB+hBNNK7jh+SdbKpcJhPtHyWld22FzLMe6I5UFv1O41c3olQDLdSz llGoov0lGtUMsz9qbDSaZSSXjZaXOktxuYHAHuaiPeIP4hMLkZe+k0kC+DeZmt5K0aXu +JZFCjLRKn1axyLaN1MmAQYShHu+S4jOe8RClaQSfogJbgxSGaaxqMLwnPja+ys8MOEy JrXQ== X-Gm-Message-State: AOJu0YzChYlDeddXy7WsZN+bQeVgDv+1E+0ze6au8H8+Pif3oTBwGueL TMZeYH0p51ZXNWRgirXCrN9oo92pRA== X-Received: by 2002:a05:6000:1818:b0:32d:9a1b:5d7f with SMTP id m24-20020a056000181800b0032d9a1b5d7fmr11330684wrh.29.1700133937381; Thu, 16 Nov 2023 03:25:37 -0800 (PST) Received: from p183 ([46.53.252.123]) by smtp.gmail.com with ESMTPSA id w3-20020a5d4b43000000b0032cc35c2ef7sm13300534wrs.29.2023.11.16.03.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 03:25:37 -0800 (PST) Date: Thu, 16 Nov 2023 14:25:35 +0300 From: Alexey Dobriyan To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Cc: linux-kernel@vger.kernel.org Subject: [PATCH] lockdep: optimise "struct lock_class" layout Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 03:26:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782719686550425992 X-GMAIL-MSGID: 1782719686550425992 struct lock_class does const struct lock_trace * usage_traces[]; int name_version; const char * name; which wastes 4 bytes after "name_version". Put pointer after pointers shrinking sizeof from 208 bytes to 200 bytes. Space savings are considerable for such a trivial patch: $ ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux add/remove: 0/0 grow/shrink: 1/11 up/down: 2/-65640 (-65638) Function old new delta check_irq_usage 2852 2854 +2 reacquire_held_locks 486 484 -2 lock_chain_get_class 41 39 -2 l_start 34 32 -2 check_noncircular 276 274 -2 print_usage_bug.part 688 683 -5 print_circular_bug 1017 1011 -6 hlock_conflict 141 135 -6 print_deadlock_bug 944 935 -9 mark_lock 3791 3769 -22 __lock_acquire 9801 9753 -48 lock_classes 1703936 1638400 -65536 Total: Before=21163908, After=21098270, chg -0.31% Signed-off-by: Alexey Dobriyan Acked-by: Waiman Long --- include/linux/lockdep_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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;