[PATCH] RDMA/core: Prevent soft lockup during large user memory region cleanup

lirongqing
2025-11-11T07:17:02Z

From: Li RongQing <lirongqing@baidu.com>

When a process exits with numerous large, pinned memory regions consisting
of 4KB pages, the cleanup of the memory region through __ib_umem_release()
may cause soft lockups. This is because unpin_user_page_range_dirty_lock()
is called in a tight loop for unpin and releasing page without yielding the
CPU.

Fix the soft lockup by adding cond_resched() calls in __ib_umem_release

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
drivers/infiniband/core/umem.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index c5b6863..70c1520 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -59,6 +59,7 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d
unpin_user_page_range_dirty_lock(sg_page(sg),
DIV_ROUND_UP(sg->length, PAGE_SIZE), make_dirty);

+ cond_resched();
sg_free_append_table(&umem->sgt_append);
}

--
2.9.4