Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1163511rdd; Wed, 10 Jan 2024 10:27:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/4ZvGwCrrsyGII5CTDJKjD5d81JR5KVk+eAg1nHl9HanOW5uWUez4O9lW4qM+Nc0L2kKR X-Received: by 2002:a05:6358:2492:b0:174:c540:dfac with SMTP id m18-20020a056358249200b00174c540dfacmr1681463rwc.50.1704911226222; Wed, 10 Jan 2024 10:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704911226; cv=none; d=google.com; s=arc-20160816; b=qW1pNdLDOHRgR1Y3knYkvcl4XNjTSDxDpOHUnZOyVuV1VvNHEaC+IhlSTy6L23NvPK rA34Db0Q58jqlUiDVrgsbILc2oI+QDOUt/KeWJH4zdkUAZhN9i209qq8LKeye+plbo8+ /6D12/nrunwDuB60masV4Zv65UOZF73zRLg79eiiKEeMcl9YTntYkJXD4HxesxSnAWxb n+iTPiulc58MLc3bUv2WzjQOo1SZcJTq2IQd06bwbWKCJ38y2OgVziLD/8P0nnocVdEb C4tS43wsYQhF/VwZ7dOpKI70hIa9kyoF7/lXKitAlR9uOKGMeu8aWxWRIFykO7laRryp FtXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=Ci4qGWcSBeiDUvGPDz+SZ63F2cKIOzMN0O16Aq5QGms=; fh=6cMQX6C5MOOXSSusBt7KV2MqIfWTqLUE++o6gVcrO7U=; b=evV0HILtLSImZ++JTIEv1mlHNAgrhWLPFwESUYjSQnrTe6IDa99lOnMsiOLHo+HbLU CP56E5ruuWCR8uQ+QpkMUxugEOYCJ9dD6XgKL3tJwZNLagM6yvIA+ss9SOrVqQCjPX34 wGCBgDfANXb6dGdR4O44pyr03VMNG9FDdsW3KRaBkvucwegajenT+pmdGjIekcc/qMmH Ph3Wh1SHSy42ETJOPP/6srN560UoJEUU/JTDAZIvuef4GGoHpQOY9Btdnho3ddF0+s/s BwhceV6mecR1csI8gehmJWezmUCAwiHq6mMwZgHH8i1OopWnLa5g/s/Yty2TOyDpover eYlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TBeBi9ld; spf=pass (google.com: domain of linux-kernel+bounces-22597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p30-20020a637f5e000000b005ce054620cesi4136546pgn.826.2024.01.10.10.27.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:27:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TBeBi9ld; spf=pass (google.com: domain of linux-kernel+bounces-22597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 91107B21D2D for ; Wed, 10 Jan 2024 18:27:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CF084D582; Wed, 10 Jan 2024 18:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TBeBi9ld" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A013495C1 for ; Wed, 10 Jan 2024 18:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d3f3ee00a2so21559295ad.3 for ; Wed, 10 Jan 2024 10:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704911211; x=1705516011; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=Ci4qGWcSBeiDUvGPDz+SZ63F2cKIOzMN0O16Aq5QGms=; b=TBeBi9ldP5HvS/NhWuZPa1TBB3c8igf0UcWYw1Icui11vZmuKi3I0YsF4d//lzGIa6 itmwSwqMqh+gFa2/pl5Hs0k18/8VNEj/U0fxXeAfp5KFvuNMwvtQbLR7i4dl3tdJge+Z odApxyhDX8Qe+2VvssNTJWOhgLEJ0CJ40apARi1quXJk7zQQgibRL72uTABk5ubgIMKh ypQCgmZUmk3BIjjM6rC7NFe2D9DBksl9GenESDEfmN2jgJYplq7hMM96OcSMZqfuRdZu 2xmVPWMeSeDoAuVsHN7JRG2XQSIUK3SBUzKVg1TLt17+80IxlScT7ne5ht9Jm76WUe0R OKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704911211; x=1705516011; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ci4qGWcSBeiDUvGPDz+SZ63F2cKIOzMN0O16Aq5QGms=; b=ld5FUcdFFaqcvCrsA8whItT61qHFGV2YVqDa/ZNKK0mMTIjTETG7r8d3zPrN+Ga7vi GpWhMpqHjkUJl7Kl6fxprVsPlow0h77vitu2Ho/SaD1lPiPrVea0KGFtkcizTVxKE0/i dBe38JWRlHenafKMsX4AJlbwi6POXC4R94gQFSggMpsUdD+e186WJ0e2nuteDABbDbsK hcJodpgKuxrzz+NSrpvyRM0dmfHLXFXd76yox0nTrqc80tQSb3YuWMsVbiY9tSjk506w +jbof1Y0BuKqIGg3YQ33uxmvdfkdtQ/tZvmJlC1XNxDthJdNS5jauw+VWsKouh8z6Jn1 udMg== X-Gm-Message-State: AOJu0YyAX2xWr2Xvz1//GUa5QHhJoPci2tXh3vOtzqVr2SwEjGMBuy/f KZXa/omg0Zh1WMrzVWHR6Oc= X-Received: by 2002:a17:902:a50d:b0:1d5:251:15d9 with SMTP id s13-20020a170902a50d00b001d5025115d9mr1002069plq.136.1704911210645; Wed, 10 Jan 2024 10:26:50 -0800 (PST) Received: from localhost (dhcp-72-253-202-210.hawaiiantel.net. [72.253.202.210]) by smtp.gmail.com with ESMTPSA id p3-20020a1709026b8300b001cfde4c84bcsm3950800plk.141.2024.01.10.10.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:26:50 -0800 (PST) Sender: Tejun Heo Date: Wed, 10 Jan 2024 08:26:49 -1000 From: Tejun Heo To: Geert Uytterhoeven Cc: gregkh@linuxfoundation.org, andrea.righi@canonical.com, ast@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] kernfs: Rearrange kernfs_node fields to reduce its size on 64bit Message-ID: References: <20240109214828.252092-1-tj@kernel.org> <20240109214828.252092-3-tj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 10, 2024 at 04:18:36PM +0100, Geert Uytterhoeven wrote: > Hi Tejun, > > On Tue, Jan 9, 2024 at 10:49 PM Tejun Heo wrote: > > Moving .flags and .mode right below .hash makes kernfs_node smaller by 8 > > bytes on 64bit. > > > > Signed-off-by: Tejun Heo > > Thanks for your patch! > > > --- a/include/linux/kernfs.h > > +++ b/include/linux/kernfs.h > > @@ -206,6 +206,9 @@ struct kernfs_node { > > > > const void *ns; /* namespace tag */ > > unsigned int hash; /* ns + name hash */ > > + unsigned short flags; > > + umode_t mode; > > + > > union { > > struct kernfs_elem_dir dir; > > struct kernfs_elem_symlink symlink; > > @@ -220,8 +223,6 @@ struct kernfs_node { > > */ > > u64 id; > > > > - unsigned short flags; > > - umode_t mode; > > struct kernfs_iattrs *iattr; > > Note that there is now a hole at the end of the structure on 32-bit > architectures > where the alignment of u64 is 8 bytes. > > Hence, sizeof(struct kernfs_node) grew from 104 to 112 bytes on (at > least) arm32 and rv32. > It did shrink by 8 bytes on amd64, arm64, mips64, and rv64. > Size is unchanged on ia32, m68k and sh. > > I didn't check any other architectures. Ah, thanks. I'll shuffle things a bit more so that the size doesn't increase for 32bits. -- tejun