WSL2-Linux-Kernel/arch/s390
Mete Durlu 4b9d72498d s390/vtime: fix average steal time calculation
[ Upstream commit 367c50f78451d3bd7ad70bc5c89f9ba6dec46ca9 ]

Current average steal timer calculation produces volatile and inflated
values. The only user of this value is KVM so far and it uses that to
decide whether or not to yield the vCPU which is seeing steal time.
KVM compares average steal timer to a threshold and if the threshold
is past then it does not allow CPU polling and yields it to host, else
it keeps the CPU by polling.
Since KVM's steal time threshold is very low by default (%10) it most
likely is not effected much by the bloated average steal timer values
because the operating region is pretty small. However there might be
new users in the future who might rely on this number. Fix average
steal timer calculation by changing the formula from:

	avg_steal_timer = avg_steal_timer / 2 + steal_timer;

to the following:

	avg_steal_timer = (avg_steal_timer + steal_timer) / 2;

This ensures that avg_steal_timer is actually a naive average of steal
timer values. It now closely follows steal timer values but of course
in a smoother manner.

Fixes: 152e9b8676 ("s390/vtime: steal time exponential moving average")
Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:21:35 -04:00
..
appldata
boot s390/ipl: add missing intersection check to ipl_report handling 2023-03-22 13:31:32 +01:00
configs s390: update defconfigs 2021-09-15 14:29:21 +02:00
crypto crypto: s390/aes - Fix buffer overread in CTR mode 2024-02-23 08:54:24 +01:00
hypfs s390/hypfs: avoid error message under KVM 2022-09-05 10:30:11 +02:00
include s390/dasd: add autoquiesce feature 2024-03-26 18:21:14 -04:00
kernel s390/vtime: fix average steal time calculation 2024-03-26 18:21:35 -04:00
kvm KVM: s390: fix setting of fpc register 2024-02-23 08:54:40 +01:00
lib s390/uaccess: add missing earlyclobber annotations to __clear_user() 2023-04-05 11:25:01 +02:00
mm KVM: s390/mm: Properly reset no-dat 2023-12-13 18:36:49 +01:00
net bpf, s390: Fix potential memory leak about jit_data 2021-10-04 09:49:10 +02:00
pci s390: use the correct count for __iowrite64_copy() 2024-03-01 13:21:59 +01:00
purgatory s390/purgatory: disable branch profiling 2023-06-28 10:29:52 +02:00
tools s390/disassembler: add instructions 2021-07-27 09:39:19 +02:00
Kbuild
Kconfig s390: remove unneeded 'select BUILD_BIN2C' 2022-07-07 17:53:27 +02:00
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile s390/decompressor: fix misaligned symbol build error 2023-07-23 13:47:55 +02:00