From: Christoph Hellwig <hch@infradead.org>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2 1/3] block: cache bdev in struct file for raw bdev IO
Date: Wed, 13 Oct 2021 16:19:11 +0100 [thread overview]
Message-ID: <YWb478zJALy7dmtN@infradead.org> (raw)
In-Reply-To: <8415f9fe12e544b9da89593dfbca8de2b52efe03.1634115360.git.asml.silence@gmail.com>
On Wed, Oct 13, 2021 at 09:57:11AM +0100, Pavel Begunkov wrote:
> bdev = &BDEV_I(file->f_mapping->host)->bdev
>
> Getting struct block_device from a file requires 2 memory dereferences
> as illustrated above, that takes a toll on performance, so cache it in
> yet unused file->private_data. That gives a noticeable peak performance
> improvement.
>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
> block/fops.c | 29 +++++++++++++----------------
> 1 file changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/block/fops.c b/block/fops.c
> index 7bb9581a146c..c71e91cd6bcb 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -17,7 +17,7 @@
> #include <linux/fs.h>
> #include "blk.h"
>
> -static struct inode *bdev_file_inode(struct file *file)
> +static inline struct inode *bdev_file_inode(struct file *file)
> {
> return file->f_mapping->host;
> }
This is unrelated to the rest.
But the actual described change looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2021-10-13 15:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 8:57 [PATCH v2 0/3] on top of for-5.16/block Pavel Begunkov
2021-10-13 8:57 ` [PATCH v2 1/3] block: cache bdev in struct file for raw bdev IO Pavel Begunkov
2021-10-13 15:19 ` Christoph Hellwig [this message]
2021-10-13 8:57 ` [PATCH v2 2/3] block: don't hide inode from block_device users Pavel Begunkov
2021-10-13 14:03 ` kernel test robot
2021-10-13 15:03 ` kernel test robot
2021-10-13 15:12 ` Pavel Begunkov
2021-10-15 0:40 ` [kbuild-all] " Chen, Rong A
2021-10-13 15:25 ` Christoph Hellwig
2021-10-13 18:44 ` Pavel Begunkov
2021-10-14 4:51 ` Christoph Hellwig
2021-10-14 9:35 ` Pavel Begunkov
2021-10-13 8:57 ` [PATCH v2 3/3] blk-mq: optimise *end_request non-stat path Pavel Begunkov
2021-10-13 15:30 ` Christoph Hellwig
2021-10-13 9:15 ` [PATCH v2 0/3] on top of for-5.16/block Pavel Begunkov
2021-10-13 15:53 ` (subset) " 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=YWb478zJALy7dmtN@infradead.org \
--to=hch@infradead.org \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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).