lib/scatterlist: add check when merging zone device pages
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 21 Oct 2022 17:41:12 +0000 (11:41 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Nov 2022 18:29:21 +0000 (11:29 -0700)
commit1567b49d1a4081ba7e1a0ff2dc39bc58c59f2a51
tree3e8e5f3d3bc23897673cd568cac69a07f85f6c4f
parent49580e690755d0e51ed7aa2c33225dd884fa738a
lib/scatterlist: 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.

Factor out the check for page mergability into a pages_are_mergable()
helper and add a check with zone_device_pages_are_mergeable().

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20221021174116.7200-6-logang@deltatee.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/scatterlist.c