mirror-linux/arch
Mete Durlu 367c50f784 s390/vtime: fix average steal time calculation
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>
2024-03-13 09:23:44 +01:00
..
alpha asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
arc asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
arm Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
arm64 Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
csky asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
hexagon asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
loongarch Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
m68k asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
microblaze arch: define CONFIG_PAGE_SIZE_*KB on all architectures 2024-03-06 19:29:09 +01:00
mips Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
nios2 arch: define CONFIG_PAGE_SIZE_*KB on all architectures 2024-03-06 19:29:09 +01:00
openrisc asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
parisc hardening updates for v6.9-rc1 2024-03-12 14:49:30 -07:00
powerpc Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
riscv Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
s390 s390/vtime: fix average steal time calculation 2024-03-13 09:23:44 +01:00
sh hardening updates for v6.9-rc1 2024-03-12 14:49:30 -07:00
sparc hardening updates for v6.9-rc1 2024-03-12 14:49:30 -07:00
um hardening updates for v6.9-rc1 2024-03-12 14:49:30 -07:00
x86 Networking changes for 6.9. 2024-03-12 17:44:08 -07:00
xtensa asm-generic updates for 6.9 2024-03-12 10:56:28 -07:00
.gitignore
Kconfig arch: consolidate existing CONFIG_PAGE_SIZE_*KB definitions 2024-03-06 19:28:26 +01:00