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:
"Two fixes: a guest-cputime accounting fix, and a cgroup bandwidth
quota precision fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/vtime: Fix guest/system mis-accounting on task switch
sched/fair: Scale bandwidth quota and period without losing quota/period ratio precision

+24 -16
+3 -3
kernel/sched/cputime.c
··· 740 740 741 741 write_seqcount_begin(&vtime->seqcount); 742 742 /* We might have scheduled out from guest path */ 743 - if (current->flags & PF_VCPU) 743 + if (tsk->flags & PF_VCPU) 744 744 vtime_account_guest(tsk, vtime); 745 745 else 746 746 __vtime_account_system(tsk, vtime); ··· 783 783 */ 784 784 write_seqcount_begin(&vtime->seqcount); 785 785 __vtime_account_system(tsk, vtime); 786 - current->flags |= PF_VCPU; 786 + tsk->flags |= PF_VCPU; 787 787 write_seqcount_end(&vtime->seqcount); 788 788 } 789 789 EXPORT_SYMBOL_GPL(vtime_guest_enter); ··· 794 794 795 795 write_seqcount_begin(&vtime->seqcount); 796 796 vtime_account_guest(tsk, vtime); 797 - current->flags &= ~PF_VCPU; 797 + tsk->flags &= ~PF_VCPU; 798 798 write_seqcount_end(&vtime->seqcount); 799 799 } 800 800 EXPORT_SYMBOL_GPL(vtime_guest_exit);
+21 -13
kernel/sched/fair.c
··· 4926 4926 if (++count > 3) { 4927 4927 u64 new, old = ktime_to_ns(cfs_b->period); 4928 4928 4929 - new = (old * 147) / 128; /* ~115% */ 4930 - new = min(new, max_cfs_quota_period); 4929 + /* 4930 + * Grow period by a factor of 2 to avoid losing precision. 4931 + * Precision loss in the quota/period ratio can cause __cfs_schedulable 4932 + * to fail. 4933 + */ 4934 + new = old * 2; 4935 + if (new < max_cfs_quota_period) { 4936 + cfs_b->period = ns_to_ktime(new); 4937 + cfs_b->quota *= 2; 4931 4938 4932 - cfs_b->period = ns_to_ktime(new); 4933 - 4934 - /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ 4935 - cfs_b->quota *= new; 4936 - cfs_b->quota = div64_u64(cfs_b->quota, old); 4937 - 4938 - pr_warn_ratelimited( 4939 - "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", 4940 - smp_processor_id(), 4941 - div_u64(new, NSEC_PER_USEC), 4942 - div_u64(cfs_b->quota, NSEC_PER_USEC)); 4939 + pr_warn_ratelimited( 4940 + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us = %lld, cfs_quota_us = %lld)\n", 4941 + smp_processor_id(), 4942 + div_u64(new, NSEC_PER_USEC), 4943 + div_u64(cfs_b->quota, NSEC_PER_USEC)); 4944 + } else { 4945 + pr_warn_ratelimited( 4946 + "cfs_period_timer[cpu%d]: period too short, but cannot scale up without losing precision (cfs_period_us = %lld, cfs_quota_us = %lld)\n", 4947 + smp_processor_id(), 4948 + div_u64(old, NSEC_PER_USEC), 4949 + div_u64(cfs_b->quota, NSEC_PER_USEC)); 4950 + } 4943 4951 4944 4952 /* reset count so we don't come right back in here */ 4945 4953 count = 0;