Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH] block: move .bd_inode into 1st cacheline of block_device
Date: Tue, 21 Nov 2023 19:21:11 +0800	[thread overview]
Message-ID: <ZVySp9kcDmpqcd9n@fedora> (raw)
In-Reply-To: <b07d6d9b-7926-d5b1-71ab-29640e2a84f8@huaweicloud.com>

On Tue, Nov 21, 2023 at 07:12:44PM +0800, Yu Kuai wrote:
> Hi,
> 
> 在 2023/11/21 18:11, Ming Lei 写道:
> > The .bd_inode field of block_device is used in IO fast path of
> > blkdev_write_iter() and blkdev_llseek(), so it is more efficient to keep
> > it into the 1st cacheline.
> > 
> > .bd_openers is only touched in open()/close(), and .bd_size_lock is only
> > for updating bdev capacity, which is in slow path too.
> > 
> > So swap .bd_inode layout with .bd_openers & .bd_size_lock to move
> > .bd_inode into the 1st cache line.
> 
> This patch looks good, do you want me do take it for a v3 for the
> other patchset?

Yeah, please take it.

> 
> And by the way, can we also move 'int bd_writers' to near 'atomic_t
> bd_fsfreeze_count' to save 8 bytes(int 64bit platform)?
> 
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index 07abd0165226..a47ab9249bdd 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -63,11 +63,11 @@ struct block_device {
>         int                     bd_holders;
>         struct kobject          *bd_holder_dir;
> 
> +       int                     bd_writers;
>         atomic_t                bd_fsfreeze_count; /* number of freeze
> requests */
>         struct mutex            bd_fsfreeze_mutex; /* serialize freeze/thaw
> */
> 
>         struct partition_meta_info *bd_meta_info;
> -       int                     bd_writers;

Which tree are you talking about? I don't see 'bd_writers' in both
linus tree and block-6.7, and for-6.8/block isn't open yet.

Thanks,
Ming


  reply	other threads:[~2023-11-21 11:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 10:11 [PATCH] block: move .bd_inode into 1st cacheline of block_device Ming Lei
2023-11-21 11:12 ` Yu Kuai
2023-11-21 11:21   ` Ming Lei [this message]
2023-11-21 11:36     ` Yu Kuai
2023-11-21 12:26       ` Ming Lei

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=ZVySp9kcDmpqcd9n@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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