From 2315707f90398a181d39f6ffda350f15826e0987 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:00:59 +0000 Subject: cgroup: fix display of forceidle time at root (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-115-cgroup-fix-display-of-forceidle-time-at-root.patch b/patches.kernel.org/6.2.12-115-cgroup-fix-display-of-forceidle-time-at-root.patch new file mode 100644 index 0000000..9a51dd2 --- /dev/null +++ b/patches.kernel.org/6.2.12-115-cgroup-fix-display-of-forceidle-time-at-root.patch @@ -0,0 +1,43 @@ +From: Josh Don +Date: Wed, 15 Mar 2023 14:40:29 -0700 +Subject: [PATCH] cgroup: fix display of forceidle time at root +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: fcdb1eda5302599045bb366e679cccb4216f3873 + +commit fcdb1eda5302599045bb366e679cccb4216f3873 upstream. + +We need to reset forceidle_sum to 0 when reading from root, since the +bstat we accumulate into is stack allocated. + +To make this more robust, just replace the existing cputime reset with a +memset of the overall bstat. + +Signed-off-by: Josh Don +Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups") +Cc: stable@vger.kernel.org # v6.0+ +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + kernel/cgroup/rstat.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c +index 793ecff2..7006fc8d 100644 +--- a/kernel/cgroup/rstat.c ++++ b/kernel/cgroup/rstat.c +@@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat) + struct task_cputime *cputime = &bstat->cputime; + int i; + +- cputime->stime = 0; +- cputime->utime = 0; +- cputime->sum_exec_runtime = 0; ++ memset(bstat, 0, sizeof(*bstat)); + for_each_possible_cpu(i) { + struct kernel_cpustat kcpustat; + u64 *cpustat = kcpustat.cpustat; +-- +2.35.3 + diff --git a/series.conf b/series.conf index 736fd69..49d0f02 100644 --- a/series.conf +++ b/series.conf @@ -2342,6 +2342,7 @@ patches.kernel.org/6.2.12-112-PCI-Fix-use-after-free-in-pci_bus_release_doma.patch patches.kernel.org/6.2.12-113-PCI-MSI-Provide-missing-stub-for-pci_msix_can_.patch patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch + patches.kernel.org/6.2.12-115-cgroup-fix-display-of-forceidle-time-at-root.patch ######################################################## # Build fixes that apply to the vanilla kernel too.