android_kernel_samsung_a7y1.../kernel
Xuewei Zhang a04e40f2c4 sched/fair: Scale bandwidth quota and period without losing quota/period ratio precision
commit 4929a4e6faa0f13289a67cae98139e727f0d4a97 upstream.

The quota/period ratio is used to ensure a child task group won't get
more bandwidth than the parent task group, and is calculated as:

  normalized_cfs_quota() = [(quota_us << 20) / period_us]

If the quota/period ratio was changed during this scaling due to
precision loss, it will cause inconsistency between parent and child
task groups.

See below example:

A userspace container manager (kubelet) does three operations:

 1) Create a parent cgroup, set quota to 1,000us and period to 10,000us.
 2) Create a few children cgroups.
 3) Set quota to 1,000us and period to 10,000us on a child cgroup.

These operations are expected to succeed. However, if the scaling of
147/128 happens before step 3, quota and period of the parent cgroup
will be changed:

  new_quota: 1148437ns,   1148us
 new_period: 11484375ns, 11484us

And when step 3 comes in, the ratio of the child cgroup will be
104857, which will be larger than the parent cgroup ratio (104821),
and will fail.

Scaling them by a factor of 2 will fix the problem.

Tested-by: Phil Auld <pauld@redhat.com>
Signed-off-by: Xuewei Zhang <xueweiz@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Phil Auld <pauld@redhat.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Fixes: 2e8e19226398 ("sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup")
Link: https://lkml.kernel.org/r/20191004001243.140897-1-xueweiz@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 12:45:36 +02:00
..
bpf bpf: silence warning messages in core 2020-04-06 19:54:55 +02:00
configs A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debug A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
events signal: Properly deliver SIGILL from uprobes 2020-04-07 12:27:23 +02:00
gcov A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq genirq: Prevent NULL pointer dereference in resend_irqs() 2020-04-06 21:35:35 +02:00
livepatch A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking locking/lockdep: Add debug_locks check in __lock_downgrade() 2020-04-07 07:36:48 +02:00
power PM / Hibernate: Call flush_icache_range() on pages restored in-place 2020-04-06 12:52:20 +02:00
printk printk: fix integer overflow in setup_log_buf() 2020-04-07 12:34:15 +02:00
rcu rcutorture: Fix cleanup path for invalid torture_type strings 2020-04-06 18:20:15 +02:00
sched sched/fair: Scale bandwidth quota and period without losing quota/period ratio precision 2020-04-07 12:45:36 +02:00
time alarmtimer: Change remaining ENOTSUPP to EOPNOTSUPP 2020-04-07 09:57:54 +02:00
trace tracing: Initialize iter->seq after zeroing in tracing_read_pipe() 2020-04-07 09:27:54 +02:00
acct.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
async.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit_fsnotify.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit_tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit_watch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
auditfilter.c audit: fix a memory leak bug 2020-04-06 18:18:45 +02:00
auditsc.c audit: print empty EXECVE args 2020-04-07 12:36:13 +02:00
backtracetest.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bounds.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
capability.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cgroup_freezer.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cgroup_pids.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cgroup.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
compat.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
configs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
context_tracking.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu_pm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu.c cpu/speculation: Warn on unsupported mitigations= parameter 2020-04-06 19:17:21 +02:00
cpuset.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crash_dump.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cred.c access: avoid the RCU grace period for the temporary subjective credentials 2020-04-06 20:24:58 +02:00
delayacct.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dma.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
elfcore.c kernel/elfcore.c: include proper prototypes 2020-04-07 08:08:10 +02:00
exec_domain.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
exit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fork.c kernel/sysctl.c: do not override max_threads provided by userspace 2020-04-07 08:09:55 +02:00
freezer.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
futex_compat.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
futex.c futex: Fix futex lock the wrong page 2020-04-06 19:02:46 +02:00
groups.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hung_task.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq_work.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
jump_label.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kallsyms.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kaslr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kcmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.freezer A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.hz A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.locks A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.preempt A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kcov.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kexec_core.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kexec_file.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kexec_internal.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kexec.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kmod.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kprobes.c kprobes: Don't call BUG_ON() if there is a kprobe in use on free list 2020-04-07 12:27:35 +02:00
ksysfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kthread.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
latencytop.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
membarrier.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
memremap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
module_signing.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
module-internal.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
module.c kernel/module.c: Only return -EEXIST for modules that have finished loading 2020-04-06 20:26:45 +02:00
notifier.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nsproxy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
padata.c padata: use smp_mb in padata_reorder to avoid orphaned padata jobs 2020-04-06 20:04:27 +02:00
panic.c panic: ensure preemption is disabled during panic() 2020-04-07 08:08:25 +02:00
params.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pid_namespace.c signal/pid_namespace: Fix reboot_pid_ns to use send_sig not force_sig 2020-04-06 19:54:23 +02:00
pid.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
profile.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ptrace.c ptrace: Fix ->ptracer_cred handling for PTRACE_TRACEME 2020-04-06 19:20:56 +02:00
range.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
reboot.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
relay.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
resource.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
seccomp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
signal.c signal: Always ignore SIGKILL and SIGSTOP sent to the global init 2020-04-07 12:27:21 +02:00
smp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
smpboot.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
smpboot.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
softirq.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stacktrace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stop_machine.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sys_ni.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sys.c kernel/sys.c: prctl: fix false positive in validate_prctl_map() 2020-04-06 19:01:43 +02:00
sysctl_binary.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sysctl.c sysctl: return -EINVAL if val violates minmax 2020-04-06 19:01:33 +02:00
task_work.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
taskstats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_kprobes.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
torture.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tracepoint.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tsacct.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
uid16.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
up.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
user_namespace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
user-return-notifier.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
user.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
utsname_sysctl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
utsname.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
watchdog.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
workqueue_internal.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
workqueue.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30