summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Rapoport (Microsoft) <rppt@kernel.org>2026-07-13 10:17:26 +0300
committerLeon Romanovsky <leon@kernel.org>2026-07-14 08:26:03 -0400
commitf8d04b0c74e989c515e0fa17bf779b730077f63e (patch)
treec1900d6d6e995e0831ab2480162c317d7c63f166
parent45bf0b3da47d75b227c35e95bc0ee15857820fa9 (diff)
downloadlinux-next-f8d04b0c74e989c515e0fa17bf779b730077f63e.tar.gz
linux-next-f8d04b0c74e989c515e0fa17bf779b730077f63e.zip
IB/rdmavt: use kzalloc() to allocate QPN-map pages
get_map_page() allocates bitmap pages using get_zeroed_page(). The bitmaps can be allocated with kmalloc() as there's nothing special about them to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and kfree() does not need to know the size of the freed object. Performance difference between kmalloc() and __get_free_pages() is not measurable as both allocators take an object/page from a per-CPU list for fast path allocations. For the slow path the performance is anyway determined by the amount of reclaim involved rather than by what allocator is used. Replace use of get_zeroed_page() with kzalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Link: https://patch.msgid.link/20260713-b4-rdma-v2-5-65d2a1a5180c@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
-rw-r--r--drivers/infiniband/sw/rdmavt/qp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 70e7d08fdce6..c40cce69e945 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -263,7 +263,7 @@ static inline bool wss_exceeds_threshold(struct rvt_wss *wss)
static void get_map_page(struct rvt_qpn_table *qpt,
struct rvt_qpn_map *map)
{
- unsigned long page = get_zeroed_page(GFP_KERNEL);
+ void *page = kzalloc(PAGE_SIZE, GFP_KERNEL);
/*
* Free the page if someone raced with us installing it.
@@ -271,9 +271,9 @@ static void get_map_page(struct rvt_qpn_table *qpt,
spin_lock(&qpt->lock);
if (map->page)
- free_page(page);
+ kfree(page);
else
- map->page = (void *)page;
+ map->page = page;
spin_unlock(&qpt->lock);
}
@@ -343,7 +343,7 @@ static void free_qpn_table(struct rvt_qpn_table *qpt)
int i;
for (i = 0; i < ARRAY_SIZE(qpt->map); i++)
- free_page((unsigned long)qpt->map[i].page);
+ kfree(qpt->map[i].page);
}
/**