1 --- linux-3.10.0-1160.11.1.el7.x86_64/kernel/timer.c 2020-11-30 12:40:05.000000000 -0500
2 +++ linux-3.10.0-1160.6.1.el7.x86_64/kernel/timer.c 2020-10-21 13:17:08.000000000 -0400
8 - * Total number of list_head entries in tv1-tv5 of struct tvec_base.
10 -#define TVEC_LEN ((offsetofend(struct tvec_base, tv5) - \
11 - offsetof(struct tvec_base, tv1)) / \
12 - sizeof(struct list_head))
15 - * requeue_timers - requeue all the timers in the timer wheel
16 - * @base: the timer vector to be processed.
18 - * When a cpu is idle for a long period of time, it is possible that
19 - * timer_jiffies can significantly lag behind jiffies making the iterative
20 - * jiffies check in __run_timers() takes a long time to complete causing
21 - * soft or hard system lockup.
23 - * This function remedies this situation by requeuing all the timers in
24 - * the cascading timer wheel and adjusting timer_jiffies to the min() of
25 - * current jiffies and the expiry times of all active timers. The expiry
26 - * times of expired deferrable timers will be set to the new timer_jiffies.
28 -static noinline void requeue_timers(struct tvec_base *base)
30 - struct timer_list *timer, *tmp;
31 - struct list_head list, head, *vecs;
32 - unsigned long min_jiffies = jiffies;
33 - unsigned long nactive = base->active_timers;
34 - unsigned long nall = base->all_timers;
37 - lockdep_assert_held(&base->lock);
38 - INIT_LIST_HEAD(&head);
41 - * tv1-tv5 are processed together as a single array of list_head's.
43 - vecs = (struct list_head *)&base->tv1;
44 - for (i = 0; i < TVEC_LEN; i++, vecs++) {
45 - if (list_empty(vecs))
48 - list_replace_init(vecs, &list);
51 - * Check all the timers in list and move them over to head.
53 - list_for_each_entry_safe(timer, tmp, &list, entry) {
55 - if (!tbase_get_deferrable(timer->base)) {
56 - base->active_timers--;
57 - if (time_before(timer->expires, min_jiffies))
58 - min_jiffies = timer->expires;
60 - list_add_tail(&timer->entry, &head);
62 - if (!base->all_timers)
65 - WARN_ON_ONCE(base->all_timers || base->active_timers);
68 - * Restore all_timers and active_timers.
69 - * Requeue timers back into timer wheel with timer_jiffies
70 - * set to min_jiffies.
72 - base->all_timers = nall;
73 - base->active_timers = nactive;
74 - base->timer_jiffies = min_jiffies;
76 - list_for_each_entry_safe(timer, tmp, &head, entry) {
77 - unsigned long old_expires;
78 - bool restore = false;
81 - * For expiry time that is < min_jiffies (deferrable ones),
82 - * temporarily change it to min_jiffies, insert the timer
83 - * without accounting and restore the expiry time.
85 - if (time_before(timer->expires, min_jiffies)) {
86 - old_expires = timer->expires;
87 - timer->expires = min_jiffies;
90 - __internal_add_timer(base, timer);
92 - timer->expires = old_expires;
96 #define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
99 @@ -1317,13 +1228,6 @@
101 spin_lock_irq(&base->lock);
104 - * Requeue the timers if jiffies - timer_jiffies >= 2*TVEC_LEN.
106 - if (base->all_timers &&
107 - time_after_eq(jiffies, base->timer_jiffies + 2 * TVEC_LEN))
108 - requeue_timers(base);
110 while (time_after_eq(jiffies, base->timer_jiffies)) {
111 struct list_head work_list;
112 struct list_head *head = &work_list;