diff options
author | Eric Dumazet <edumazet@google.com> | 2025-03-08 17:48:17 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-29 11:02:19 +0200 |
commit | d0dc233fe22412b2ddec3ead6419a495f2769d1f (patch) | |
tree | 9450703ff46a74b1b7b01fecbc6951e2b97b6a9e | |
parent | 135dde13b96d565d8bcd69e7350f29fc1aade0e5 (diff) |
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>
-rw-r--r-- | kernel/time/posix-timers.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 4576aaed13b2..896ff735034c 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -118,6 +118,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; |