diff options
author | Hao Jia <jiahao.os@bytedance.com> | 2022-08-06 20:05:08 +0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2022-08-15 12:35:13 -1000 |
commit | 2b97cf76289a4fcae66d7959b0d74a87207d7068 (patch) | |
tree | 43cbcf0d61b3ef4145c1a6d52365e85773a0bd11 /include/linux/sunrpc/svc_xprt.h | |
parent | 568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff) | |
download | linux-stable-2b97cf76289a4fcae66d7959b0d74a87207d7068.tar.gz linux-stable-2b97cf76289a4fcae66d7959b0d74a87207d7068.tar.bz2 linux-stable-2b97cf76289a4fcae66d7959b0d74a87207d7068.zip |
sched/psi: Zero the memory of struct psi_group
After commit 5f69a6577bc3 ("psi: dont alloc memory for psi by default"),
the memory used by struct psi_group is no longer allocated and zeroed
in cgroup_create().
Since the memory of struct psi_group is not zeroed, the data in this
memory is random, which will lead to inaccurate psi statistics when
creating a new cgroup.
So we use kzlloc() to allocate and zero the struct psi_group and
remove the redundant zeroing in group_init().
Steps to reproduce:
1. Use cgroup v2 and enable CONFIG_PSI
2. Create a new cgroup, and query psi statistics
mkdir /sys/fs/cgroup/test
cat /sys/fs/cgroup/test/cpu.pressure
some avg10=0.00 avg60=0.00 avg300=47927752200.00 total=12884901
full avg10=561815124.00 avg60=125835394188.00 avg300=1077090462000.00 total=10273561772
cat /sys/fs/cgroup/test/io.pressure
some avg10=1040093132823.95 avg60=1203770351379.21 avg300=3862252669559.46 total=4294967296
full avg10=921884564601.39 avg60=0.00 avg300=1984507298.35 total=442381631
cat /sys/fs/cgroup/test/memory.pressure
some avg10=232476085778.11 avg60=0.00 avg300=0.00 total=0
full avg10=0.00 avg60=0.00 avg300=2585658472280.57 total=12884901
Fixes: commit 5f69a6577bc3 ("psi: dont alloc memory for psi by default")
Signed-off-by: Hao Jia <jiahao.os@bytedance.com>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/sunrpc/svc_xprt.h')
0 files changed, 0 insertions, 0 deletions