From: Christoph Hellwig <hch@lst.de>
To: Nitesh Shetty <nj.shetty@samsung.com>
Cc: Vincent Fu <vincent.fu@samsung.com>,
linux-doc@vger.kernel.org, djwong@kernel.org,
linux-nvme@lists.infradead.org, dm-devel@redhat.com,
Christoph Hellwig <hch@lst.de>, Alasdair Kergon <agk@redhat.com>,
Sagi Grimberg <sagi@grimberg.me>,
linux-scsi@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
gost.dev@samsung.com, nitheshshetty@gmail.com,
willy@infradead.org, Chaitanya Kulkarni <kch@nvidia.com>,
Anuj Gupta <anuj20.g@samsung.com>,
Mike Snitzer <snitzer@kernel.org>,
ming.lei@redhat.com, linux-block@vger.kernel.org,
dlemoal@kernel.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Keith Busch <kbusch@kernel.org>,
bvanassche@acm.org, Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>,
martin.petersen@oracle.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [dm-devel] [PATCH v13 3/9] block: add emulation for copy
Date: Thu, 20 Jul 2023 09:50:50 +0200 [thread overview]
Message-ID: <20230720075050.GB5042@lst.de> (raw)
In-Reply-To: <20230627183629.26571-4-nj.shetty@samsung.com>
> +static void *blkdev_copy_alloc_buf(sector_t req_size, sector_t *alloc_size,
> + gfp_t gfp_mask)
> +{
> + int min_size = PAGE_SIZE;
> + void *buf;
> +
> + while (req_size >= min_size) {
> + buf = kvmalloc(req_size, gfp_mask);
> + if (buf) {
> + *alloc_size = req_size;
> + return buf;
> + }
> + /* retry half the requested size */
> + req_size >>= 1;
> + }
> +
> + return NULL;
Is there any good reason for using vmalloc instead of a bunch
of distcontiguous pages?
> + ctx = kzalloc(sizeof(struct copy_ctx), gfp_mask);
> + if (!ctx)
> + goto err_ctx;
I'd suspect it would be better to just allocte a single buffer and
only have a single outstanding copy. That will reduce the bandwith
you can theoretically get, but copies tend to be background operations
anyway. It will reduce the required memory, and thus the chance for
this operation to fail on a loaded system. It will also dramatically
reduce the effect on memory managment.
> + read_bio = bio_map_kern(in, buf, buf_len, gfp_mask);
> + if (IS_ERR(read_bio))
> + goto err_read_bio;
> +
> + write_bio = bio_map_kern(out, buf, buf_len, gfp_mask);
> + if (IS_ERR(write_bio))
> + goto err_write_bio;
bio_map_kern is only for passthrough I/Os. You need to use
a bio_add_page loop here.
> index 336146798e56..f8c80940c7ad 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -562,4 +562,9 @@ struct cio {
> atomic_t refcount;
> };
>
> +struct copy_ctx {
> + struct cio *cio;
> + struct work_struct dispatch_work;
> + struct bio *write_bio;
> +};
This is misnamed as it's only used by the fallback code, and also
should be private to blk-lib.c.
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2023-07-20 7:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230627183950epcas5p1b924785633509f612ffa5d9616bfe447@epcas5p1.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 0/9] Implement copy offload support Nitesh Shetty
[not found] ` <CGME20230627184000epcas5p1c7cb01eb1c70bc5a19f76ce21f2ec3f8@epcas5p1.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 1/9] block: Introduce queue limits for copy-offload support Nitesh Shetty
2023-06-28 6:40 ` Damien Le Moal
2023-06-28 15:35 ` Nitesh Shetty
2023-07-20 7:06 ` Christoph Hellwig
2023-07-20 7:58 ` Christoph Hellwig
[not found] ` <CGME20230627184010epcas5p4bb6581408d9b67bbbcad633fb26689c9@epcas5p4.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 2/9] block: Add copy offload support infrastructure Nitesh Shetty
2023-06-28 6:45 ` Damien Le Moal
2023-06-28 16:03 ` Nitesh Shetty
2023-07-20 7:42 ` Christoph Hellwig
2023-07-27 10:29 ` Nitesh Shetty
[not found] ` <CGME20230627184020epcas5p13fdcea52edead5ffa3fae444f923439e@epcas5p1.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 3/9] block: add emulation for copy Nitesh Shetty
2023-06-28 6:50 ` Damien Le Moal
2023-06-28 16:10 ` Nitesh Shetty
2023-06-29 8:33 ` Ming Lei
2023-06-30 11:22 ` Nitesh Shetty
2023-07-20 7:50 ` Christoph Hellwig [this message]
2023-08-01 13:07 ` Nitesh Shetty
2023-08-02 6:31 ` Kent Overstreet
[not found] ` <CGME20230627184029epcas5p49a29676fa6dff5f24ddfa5c64e525a51@epcas5p4.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 4/9] fs, block: copy_file_range for def_blk_ops for direct block device Nitesh Shetty
2023-06-28 6:51 ` Damien Le Moal
2023-06-28 16:39 ` Nitesh Shetty
2023-07-20 7:57 ` Christoph Hellwig
2023-07-24 5:46 ` Nitesh Shetty
[not found] ` <CGME20230627184039epcas5p2decb92731d3e7dfdf9f2c05309a90bd7@epcas5p2.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 5/9] nvme: add copy offload support Nitesh Shetty
2023-07-20 8:00 ` Christoph Hellwig
[not found] ` <CGME20230627184049epcas5p293a6e6b75c93e39c7fca1a702e3e3774@epcas5p2.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 6/9] nvmet: add copy command support for bdev and file ns Nitesh Shetty
[not found] ` <CGME20230627184058epcas5p2226835b15381b856859b162e58572d63@epcas5p2.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 7/9] dm: Add support for copy offload Nitesh Shetty
[not found] ` <CGME20230627184107epcas5p3e01453c42bafa3ba08b8c8ba183927e6@epcas5p3.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 8/9] dm: Enable copy offload for dm-linear target Nitesh Shetty
[not found] ` <CGME20230627184117epcas5p3a9102988870743b20127422928f072bd@epcas5p3.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 9/9] null_blk: add support for copy offload Nitesh Shetty
2023-06-28 12:11 ` kernel test robot
2023-06-28 12:52 ` kernel test robot
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=20230720075050.GB5042@lst.de \
--to=hch@lst.de \
--cc=agk@redhat.com \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=bvanassche@acm.org \
--cc=corbet@lwn.net \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dm-devel@redhat.com \
--cc=gost.dev@samsung.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=nitheshshetty@gmail.com \
--cc=nj.shetty@samsung.com \
--cc=sagi@grimberg.me \
--cc=snitzer@kernel.org \
--cc=vincent.fu@samsung.com \
--cc=viro@zeniv.linux.org.uk \
--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;
as well as URLs for NNTP newsgroup(s).