From: Christoph Hellwig <hch@lst.de>
To: Kundan Kumar <kundan.kumar@samsung.com>
Cc: axboe@kernel.dk, hch@lst.de, willy@infradead.org,
linux-block@vger.kernel.org, joshi.k@samsung.com,
mcgrof@kernel.org, anuj20.g@samsung.com, nj.shetty@samsung.com,
c.gameti@samsung.com, gost.dev@samsung.com
Subject: Re: [PATCH v2] block : add larger order folio size instead of pages
Date: Thu, 2 May 2024 07:35:53 +0200 [thread overview]
Message-ID: <20240502053553.GA27922@lst.de> (raw)
In-Reply-To: <20240430175014.8276-1-kundan.kumar@samsung.com>
> - Changed functions bio_iov_add_page() and bio_iov_add_zone_append_page() to
> accept a folio
Those should be separate prep patches.
> - Added change in NVMe driver to use nvme_setup_prp_simple() by ignoring
> multiples of NVME_CTRL_PAGE_SIZE in offset
This should also be a prep patch.
> - Added change to unpin_user_pages which were added as folios. Also stopped
> the unpin of pages one by one from __bio_release_pages()(Suggested by
> Keith)
and this as well.
> @@ -1289,16 +1285,30 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>
> for (left = size, i = 0; left > 0; left -= len, i++) {
> struct page *page = pages[i];
> + folio = page_folio(page);
Please keep an empty line after declarations. But I think you can also
just move the folio declaration here and combine the lines, i.e.
struct page *page = pages[i];
struct folio *folio = page_folio(page);
...
> + /* See the offset in folio and the size */
> + folio_offset = (folio_page_idx(folio, page)
> + << PAGE_SHIFT) + offset;
Kernel coding style keeps the operators on the previous line, i.e.
folio_offset = (folio_page_idx(folio, page) << PAGE_SHIFT) +
offset;
> + size_folio = folio_size(folio);
> +
> + /* Calculate the length of folio to be added */
> + len = min_t(size_t, (size_folio - folio_offset), left);
size_folio is only used in this expression, so we can simplify the code
by just removing the variable:
/* Calculate how much of the folio we're going to add: */
len = min_t(size_t, folio_size(folio) - folio_offset, left);
> + /* Skip the pages which got added */
> + if (bio_flagged(bio, BIO_PAGE_PINNED) && num_pages > 1)
> + unpin_user_pages(pages + i, num_pages - 1);
The comment doesn't sound quite correct to me: we're not really skipping
the pages, but we are dropping the extra references early here.
> if (!is_pci_p2pdma_page(bv.bv_page)) {
> - if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
> + if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1))
> + + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
Sme comment about overator placement as above.
next prev parent reply other threads:[~2024-05-02 5:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240430175735epcas5p103ac74e1482eda3e393c0034cea8e9ff@epcas5p1.samsung.com>
2024-04-30 17:50 ` [PATCH v2] block : add larger order folio size instead of pages Kundan Kumar
2024-05-02 5:35 ` Christoph Hellwig [this message]
2024-05-07 11:19 ` Kundan Kumar
2024-05-02 6:45 ` Hannes Reinecke
2024-05-02 11:52 ` Kundan Kumar
2024-05-02 12:53 ` [PATCH v2] " Christoph Hellwig
2024-05-03 15:26 ` Matthew Wilcox
2024-05-03 16:22 ` Christoph Hellwig
2024-05-04 12:35 ` Hannes Reinecke
2024-05-04 16:32 ` Matthew Wilcox
2024-05-05 12:10 ` Hannes Reinecke
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=20240502053553.GA27922@lst.de \
--to=hch@lst.de \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=c.gameti@samsung.com \
--cc=gost.dev@samsung.com \
--cc=joshi.k@samsung.com \
--cc=kundan.kumar@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=nj.shetty@samsung.com \
--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