From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/2] block: re-arrange the struct block_device fields for better layout
Date: Fri, 14 Apr 2023 07:48:47 -0600 [thread overview]
Message-ID: <20230414134848.91563-2-axboe@kernel.dk> (raw)
In-Reply-To: <20230414134848.91563-1-axboe@kernel.dk>
This moves struct device out-of-line as it's just used at open/close
time, so we can keep some of the commonly used fields closer together.
On a standard setup, it also reduces the size from 864 bytes to 848
bytes. Yes, struct device is a pig...
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
include/linux/blk_types.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 99be590f952f..d68d6e951fad 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -40,26 +40,25 @@ struct bio_crypt_ctx;
struct block_device {
sector_t bd_start_sect;
sector_t bd_nr_sectors;
+ struct gendisk * bd_disk;
+ struct request_queue * bd_queue;
struct disk_stats __percpu *bd_stats;
unsigned long bd_stamp;
bool bd_read_only; /* read-only policy */
+ u8 bd_partno;
+ bool bd_write_holder;
dev_t bd_dev;
atomic_t bd_openers;
+ spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
struct inode * bd_inode; /* will die */
struct super_block * bd_super;
void * bd_claiming;
- struct device bd_device;
void * bd_holder;
+ /* The counter of freeze processes */
+ int bd_fsfreeze_count;
int bd_holders;
- bool bd_write_holder;
struct kobject *bd_holder_dir;
- u8 bd_partno;
- spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
- struct gendisk * bd_disk;
- struct request_queue * bd_queue;
- /* The counter of freeze processes */
- int bd_fsfreeze_count;
/* Mutex for freeze */
struct mutex bd_fsfreeze_mutex;
struct super_block *bd_fsfreeze_sb;
@@ -68,6 +67,7 @@ struct block_device {
#ifdef CONFIG_FAIL_MAKE_REQUEST
bool bd_make_it_fail;
#endif
+ struct device bd_device;
} __randomize_layout;
#define bdev_whole(_bdev) \
--
2.39.2
next prev parent reply other threads:[~2023-04-14 13:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 13:48 [PATCHSET 0/2] Optimize block_device utilization Jens Axboe
2023-04-14 13:48 ` Jens Axboe [this message]
2023-04-16 5:51 ` [PATCH 1/2] block: re-arrange the struct block_device fields for better layout Christoph Hellwig
2023-04-16 19:01 ` Jens Axboe
2023-04-14 13:48 ` [PATCH 2/2] block: store bdev->bd_disk->fops->submit_bio state in bdev Jens Axboe
2023-04-15 2:43 ` Damien Le Moal
2023-04-15 3:41 ` Jens Axboe
2023-04-16 5:53 ` Christoph Hellwig
2023-04-16 18:59 ` Jens Axboe
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=20230414134848.91563-2-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).