From: Junchao Sun <sunjunchao2870@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: chandan.babu@oracle.com, djwong@kernel.org, willy@infradead.org,
Junchao Sun <sunjunchao2870@gmail.com>
Subject: [PATCH v2] xfs: reorder xfs_inode structure elements to remove unneeded padding.
Date: Wed, 19 Jun 2024 18:06:37 +0800 [thread overview]
Message-ID: <20240619100637.392329-1-sunjunchao2870@gmail.com> (raw)
By reordering the elements in the xfs_inode structure, we can
reduce the padding needed on an x86_64 system by 8 bytes.
Furthermore, it also enables denser packing of xfs_inode
structures within slab pages. In the Debian 6.8.12-amd64,
before applying the patch, the size of xfs_inode is 1000 bytes,
allowing 32 xfs_inode structures to be allocated from an
order-3 slab. After applying the patch, the size of
xfs_inode is reduced to 992 bytes, allowing 33 xfs_inode
structures to be allocated from an order-3 slab.
This improvement is also observed in the mainline kernel
with the same config.
Signed-off-by: Junchao Sun <sunjunchao2870@gmail.com>
---
fs/xfs/xfs_inode.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 292b90b5f2ac..fedac2792a38 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -37,12 +37,6 @@ typedef struct xfs_inode {
struct xfs_ifork i_df; /* data fork */
struct xfs_ifork i_af; /* attribute fork */
- /* Transaction and locking information. */
- struct xfs_inode_log_item *i_itemp; /* logging information */
- struct rw_semaphore i_lock; /* inode lock */
- atomic_t i_pincount; /* inode pin count */
- struct llist_node i_gclist; /* deferred inactivation list */
-
/*
* Bitsets of inode metadata that have been checked and/or are sick.
* Callers must hold i_flags_lock before accessing this field.
@@ -88,6 +82,12 @@ typedef struct xfs_inode {
/* VFS inode */
struct inode i_vnode; /* embedded VFS inode */
+ /* Transaction and locking information. */
+ struct xfs_inode_log_item *i_itemp; /* logging information */
+ struct rw_semaphore i_lock; /* inode lock */
+ struct llist_node i_gclist; /* deferred inactivation list */
+ atomic_t i_pincount; /* inode pin count */
+
/* pending io completions */
spinlock_t i_ioend_lock;
struct work_struct i_ioend_work;
--
2.39.2
next reply other threads:[~2024-06-19 10:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 10:06 Junchao Sun [this message]
2024-07-01 2:16 ` [PATCH v2] xfs: reorder xfs_inode structure elements to remove unneeded padding Dave Chinner
2024-07-02 6:15 ` JunChao Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240619100637.392329-1-sunjunchao2870@gmail.com \
--to=sunjunchao2870@gmail.com \
--cc=chandan.babu@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox