Skip to content

Commit 5f2909c

Browse files
edumazetKAGA-KOKO
authored andcommitted
posix-timers: Add cond_resched() to posix_timer_add() search loop
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/all/[email protected] Link: https://lore.kernel.org/all/[email protected]
1 parent 45ece99 commit 5f2909c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/time/posix-timers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static int posix_timer_add(struct k_itimer *timer)
144144
return id;
145145
}
146146
spin_unlock(&hash_lock);
147+
cond_resched();
147148
}
148149
/* POSIX return code when no timer ID could be allocated */
149150
return -EAGAIN;

0 commit comments

Comments
 (0)