aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/block/bio.c
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2022-10-21 11:41:11 -0600
committerJens Axboe <axboe@kernel.dk>2022-11-09 11:29:21 -0700
commit49580e690755d0e51ed7aa2c33225dd884fa738a (patch)
treea09c9ec77246bf13bf097bf31695bca11571435a /block/bio.c
parentiov_iter: introduce iov_iter_get_pages_[alloc_]flags() (diff)
downloadwireguard-linux-49580e690755d0e51ed7aa2c33225dd884fa738a.tar.xz
wireguard-linux-49580e690755d0e51ed7aa2c33225dd884fa738a.zip
block: add check when merging zone device pages
Consecutive zone device pages should not be merged into the same sgl or bvec segment with other types of pages or if they belong to different pgmaps. Otherwise getting the pgmap of a given segment is not possible without scanning the entire segment. This helper returns true either if both pages are not zone device pages or both pages are zone device pages with the same pgmap. Add a helper to determine if zone device pages are mergeable and use this helper in page_is_mergeable(). Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20221021174116.7200-5-logang@deltatee.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
-rw-r--r--block/bio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c
index 57c2f327225b..c7a124294828 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -863,6 +863,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
return false;
if (xen_domain() && !xen_biovec_phys_mergeable(bv, page))
return false;
+ if (!zone_device_pages_have_same_pgmap(bv->bv_page, page))
+ return false;
*same_page = ((vec_end_addr & PAGE_MASK) == page_addr);
if (*same_page)