Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
"A deadline scheduler warning/race fix, and a cfs_period_us quota
calculation workaround where the real fix looks too involved to merge
immediately"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/deadline: Correctly handle active 0-lag timers
sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup

+26 -2
+1 -2
kernel/sched/deadline.c
··· 252 252 if (dl_entity_is_special(dl_se)) 253 253 return; 254 254 255 - WARN_ON(hrtimer_active(&dl_se->inactive_timer)); 256 255 WARN_ON(dl_se->dl_non_contending); 257 256 258 257 zerolag_time = dl_se->deadline - ··· 268 269 * If the "0-lag time" already passed, decrease the active 269 270 * utilization now, instead of starting a timer 270 271 */ 271 - if (zerolag_time < 0) { 272 + if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) { 272 273 if (dl_task(p)) 273 274 sub_running_bw(dl_se, dl_rq); 274 275 if (!dl_task(p) || p->state == TASK_DEAD) {
+25
kernel/sched/fair.c
··· 4885 4885 return HRTIMER_NORESTART; 4886 4886 } 4887 4887 4888 + extern const u64 max_cfs_quota_period; 4889 + 4888 4890 static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) 4889 4891 { 4890 4892 struct cfs_bandwidth *cfs_b = ··· 4894 4892 unsigned long flags; 4895 4893 int overrun; 4896 4894 int idle = 0; 4895 + int count = 0; 4897 4896 4898 4897 raw_spin_lock_irqsave(&cfs_b->lock, flags); 4899 4898 for (;;) { 4900 4899 overrun = hrtimer_forward_now(timer, cfs_b->period); 4901 4900 if (!overrun) 4902 4901 break; 4902 + 4903 + if (++count > 3) { 4904 + u64 new, old = ktime_to_ns(cfs_b->period); 4905 + 4906 + new = (old * 147) / 128; /* ~115% */ 4907 + new = min(new, max_cfs_quota_period); 4908 + 4909 + cfs_b->period = ns_to_ktime(new); 4910 + 4911 + /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ 4912 + cfs_b->quota *= new; 4913 + cfs_b->quota = div64_u64(cfs_b->quota, old); 4914 + 4915 + pr_warn_ratelimited( 4916 + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", 4917 + smp_processor_id(), 4918 + div_u64(new, NSEC_PER_USEC), 4919 + div_u64(cfs_b->quota, NSEC_PER_USEC)); 4920 + 4921 + /* reset count so we don't come right back in here */ 4922 + count = 0; 4923 + } 4903 4924 4904 4925 idle = do_sched_cfs_period_timer(cfs_b, overrun, flags); 4905 4926 }