public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] block: fix pgmap handling for zone device pages in bio merge paths
@ 2026-04-01  8:23 Naman Jain
  2026-04-01  8:23 ` [PATCH 1/2] block: add pgmap check to biovec_phys_mergeable Naman Jain
  2026-04-01  8:23 ` [PATCH 2/2] block: allow different-pgmap pages as separate bvecs in bio_add_page Naman Jain
  0 siblings, 2 replies; 10+ messages in thread
From: Naman Jain @ 2026-04-01  8:23 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Chaitanya Kulkarni, John Hubbard,
	Logan Gunthorpe, linux-kernel, linux-block, Saurabh Sengar,
	Long Li, Michael Kelley, namjain

When zone device memory is registered in multiple chunks, each chunk
gets its own dev_pagemap. A single bio can contain bvecs from different
pgmaps -- iov_iter_extract_bvecs() breaks at pgmap boundaries but the
outer loop in bio_iov_iter_get_pages() continues filling the same bio.

There are two problems with the current code:

1. biovec_phys_mergeable() has no pgmap check, so the request merge,
   DMA mapping, and integrity merge paths can coalesce physically
   contiguous bvec segments from different pgmaps. This makes it
   impossible to recover the correct pgmap for the merged segment
   via page_pgmap().

2. bio_add_page() and bio_integrity_add_page() reject pages from a
   different pgmap entirely (returning 0), rather than just skipping
   the merge and adding them as new bvec entries. This forces callers
   to start a new bio unnecessarily.

Patch 1 fixes the merge-path gap by adding a pgmap check to
biovec_phys_mergeable().

Patch 2 fixes the bio_add_page() and bio_integrity_add_page() API
behavior, moving the pgmap check into the merge conditional so
different-pgmap pages can be added as separate bvec entries. This
depends on patch 1 being in place.

Naman Jain (2):
  block: add pgmap check to biovec_phys_mergeable
  block: allow different-pgmap pages as separate bvecs in bio_add_page

 block/bio-integrity.c | 6 ++----
 block/bio.c           | 6 ++----
 block/blk.h           | 2 ++
 3 files changed, 6 insertions(+), 8 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-04-07  7:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  8:23 [PATCH 0/2] block: fix pgmap handling for zone device pages in bio merge paths Naman Jain
2026-04-01  8:23 ` [PATCH 1/2] block: add pgmap check to biovec_phys_mergeable Naman Jain
2026-04-01 14:07   ` Christoph Hellwig
2026-04-01  8:23 ` [PATCH 2/2] block: allow different-pgmap pages as separate bvecs in bio_add_page Naman Jain
2026-04-01 14:08   ` Christoph Hellwig
2026-04-02  5:21     ` Naman Jain
2026-04-02  5:30       ` Christoph Hellwig
2026-04-02  8:55         ` Naman Jain
2026-04-07  5:52           ` Christoph Hellwig
2026-04-07  7:08             ` Naman Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox