From: Kundan Kumar <kundan.kumar@samsung.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: axboe@kernel.dk, hch@lst.de, kbusch@kernel.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 v8 1/5] block: Added folio-ized version of bvec_try_merge_hw_page()
Date: Tue, 20 Aug 2024 13:13:21 +0530 [thread overview]
Message-ID: <20240820074321.i5budzkt4efcqodd@green245> (raw)
In-Reply-To: <ZsAlsjZeNmsBI6J0@casper.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]
On 17/08/24 05:23AM, Matthew Wilcox wrote:
>On Thu, Jul 11, 2024 at 10:37:46AM +0530, Kundan Kumar wrote:
>> -bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv,
>> - struct page *page, unsigned len, unsigned offset,
>> +bool bvec_try_merge_hw_folio(struct request_queue *q, struct bio_vec *bv,
>> + struct folio *folio, size_t len, size_t offset,
>> bool *same_page)
>> {
>> + struct page *page = folio_page(folio, 0);
>> unsigned long mask = queue_segment_boundary(q);
>> phys_addr_t addr1 = bvec_phys(bv);
>> phys_addr_t addr2 = page_to_phys(page) + offset + len - 1;
>[...]
>> +bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv,
>> + struct page *page, unsigned int len, unsigned int offset,
>> + bool *same_page)
>> +{
>> + struct folio *folio = page_folio(page);
>> +
>> + return bvec_try_merge_hw_folio(q, bv, folio, len,
>> + ((size_t)folio_page_idx(folio, page) << PAGE_SHIFT) +
>> + offset, same_page);
>> +}
>
>This is the wrong way to do it. bio_add_folio() does it correctly
>by being a wrapper around bio_add_page().
>
>The reason is that in the future, not all pages will belong to folios.
>For those pages, page_folio() will return NULL, and this will crash.
>
I can change in this fashion. page_folio is getting used at many other
places in kernel and currently there are no NULL checks. Will every place
need a change?
In this series we use page_folio to fetch folio for pages returned by
iov_iter_extract_pages. Then we iterate on the folios instead of pages.
We were progressing to change all the page related functions to accept
struct folio.
If page_folio may return NULL in future, it will require us to maintain
both page and folio versions. Do you see it differently ?
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2024-08-20 7:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240711051521epcas5p348f2cd84a1a80577754929143255352b@epcas5p3.samsung.com>
2024-07-11 5:07 ` [PATCH v8 0/5] block: add larger order folio instead of pages Kundan Kumar
2024-07-11 5:07 ` [PATCH v8 1/5] block: Added folio-ized version of bvec_try_merge_hw_page() Kundan Kumar
2024-08-17 4:23 ` Matthew Wilcox
2024-08-20 7:43 ` Kundan Kumar [this message]
2024-08-27 8:22 ` Kundan Kumar
2024-07-11 5:07 ` [PATCH v8 2/5] block: Added folio-ized version of bio_add_hw_page() Kundan Kumar
2024-07-11 5:07 ` [PATCH v8 3/5] block: introduce folio awareness and add a bigger size from folio Kundan Kumar
2024-07-25 20:56 ` Anuj gupta
2024-07-11 5:07 ` [PATCH v8 4/5] mm: release number of pages of a folio Kundan Kumar
2024-07-11 5:07 ` [PATCH v8 5/5] block: unpin user pages belonging to a folio at once Kundan Kumar
2024-07-18 6:17 ` Kundan Kumar
2024-07-25 20:40 ` Anuj gupta
2024-08-17 4:36 ` Matthew Wilcox
2024-08-08 23:04 ` [PATCH v8 0/5] block: add larger order folio instead of pages Luis Chamberlain
2024-08-12 13:38 ` Christoph Hellwig
2024-08-12 16:35 ` Luis Chamberlain
2024-08-16 8:45 ` Kundan Kumar
2024-08-17 1:22 ` Luis Chamberlain
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=20240820074321.i5budzkt4efcqodd@green245 \
--to=kundan.kumar@samsung.com \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=c.gameti@samsung.com \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--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