]> git.hungrycats.org Git - linux/commit
iommufd/iova_bitmap: Consider page offset for the pages to be pinned
authorJoao Martins <joao.m.martins@oracle.com>
Fri, 2 Feb 2024 13:34:15 +0000 (13:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:26:35 +0000 (13:26 +0100)
commit47e93d2f286eb062175ee1d89128887f0a2e8dc5
treeb38590c6c249fd8eca6f2b11f595959d20ff1b2d
parentc5bc02f60d278637101837c3c295021efeca74d9
iommufd/iova_bitmap: Consider page offset for the pages to be pinned

[ Upstream commit 4bbcbc6ea2fa379632a24c14cfb47aa603816ac6 ]

For small bitmaps that aren't PAGE_SIZE aligned *and* that are less than
512 pages in bitmap length, use an extra page to be able to cover the
entire range e.g. [1M..3G] which would be iterated more efficiently in a
single iteration, rather than two.

Fixes: b058ea3ab5af ("vfio/iova_bitmap: refactor iova_bitmap_set() to better handle page boundaries")
Link: https://lore.kernel.org/r/20240202133415.23819-10-joao.m.martins@oracle.com
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Avihai Horon <avihaih@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/iova_bitmap.c