]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
RDMA/core: Reduce cond_resched() frequency in __ib_umem_release
authorLi RongQing <lirongqing@baidu.com>
Wed, 26 Nov 2025 02:51:47 +0000 (10:51 +0800)
committerLeon Romanovsky <leon@kernel.org>
Wed, 26 Nov 2025 08:15:36 +0000 (03:15 -0500)
commitf37e2868792335f2e8bbdcc02ebbb4830453f83c
tree5766bccca5963407d78133f2ba3a5500fe679735
parent01dad9ca37c60d08f71e2ef639875ae895deede6
RDMA/core: Reduce cond_resched() frequency in __ib_umem_release

The current implementation calls cond_resched() for every SG entry
in __ib_umem_release(), which can increase needless overhead.

This patch introduces RESCHED_LOOP_CNT_THRESHOLD (0x1000) to limit
how often cond_resched() is called. The function now yields the CPU
once every 4096 iterations, and yield at the very first iteration
for lots of small umem case, to reduce scheduling overhead.

Fixes: d056bc45b62b ("RDMA/core: Prevent soft lockup during large user memory region cleanup")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Link: https://patch.msgid.link/20251126025147.2627-1-lirongqing@baidu.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/umem.c