summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-03-08 17:48:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-04 14:37:00 +0200
commitb546e22245f6644b5ca025f433740a0980151517 (patch)
tree9c24965c5d40147ba56854c3dedab779882b314c /kernel
parent5239ba49ad23a2285b4c2d15bec71566d32e0300 (diff)
downloadlinux-b546e22245f6644b5ca025f433740a0980151517.tar.gz
linux-b546e22245f6644b5ca025f433740a0980151517.tar.bz2
linux-b546e22245f6644b5ca025f433740a0980151517.zip
posix-timers: Add cond_resched() to posix_timer_add() search loop
[ Upstream commit 5f2909c6cd13564a07ae692a95457f52295c4f22 ] With a large number of POSIX timers the search for a valid ID might cause a soft lockup on PREEMPT_NONE/VOLUNTARY kernels. Add cond_resched() to the loop to prevent that. [ tglx: Split out from Eric's series ] Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/all/20250214135911.2037402-2-edumazet@google.com Link: https://lore.kernel.org/all/20250308155623.635612865@linutronix.de Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/posix-timers.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 29569b1c3d8c..3a68c650ff2a 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -161,6 +161,7 @@ static int posix_timer_add(struct k_itimer *timer)
return id;
}
spin_unlock(&hash_lock);
+ cond_resched();
}
/* POSIX return code when no timer ID could be allocated */
return -EAGAIN;