All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-15 21:40 ` Josh Don
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Don @ 2023-03-15 21:40 UTC (permalink / raw)
  To: Tejun Heo, Zefan Li, Johannes Weiner; +Cc: cgroups, linux-kernel, Josh Don

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 <joshdon@google.com>
---
 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 831f1f472bb8..0a2b4967e333 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.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-15 21:40 ` Josh Don
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Don @ 2023-03-15 21:40 UTC (permalink / raw)
  To: Tejun Heo, Zefan Li, Johannes Weiner
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Josh Don

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 <joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
---
 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 831f1f472bb8..0a2b4967e333 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.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] cgroup: fix display of forceidle time at root
  2023-03-15 21:40 ` Josh Don
  (?)
@ 2023-03-16  2:19 ` Waiman Long
  2023-03-16 18:52     ` Josh Don
  -1 siblings, 1 reply; 7+ messages in thread
From: Waiman Long @ 2023-03-16  2:19 UTC (permalink / raw)
  To: Josh Don, Tejun Heo, Zefan Li, Johannes Weiner; +Cc: cgroups, linux-kernel

On 3/15/23 17:40, Josh Don wrote:
> 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 <joshdon@google.com>
> ---
>   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 831f1f472bb8..0a2b4967e333 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;

How about adding the following fixes tag?

Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups")

Cheers,
Longman


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-16 18:52     ` Josh Don
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Don @ 2023-03-16 18:52 UTC (permalink / raw)
  To: Waiman Long; +Cc: Tejun Heo, Zefan Li, Johannes Weiner, cgroups, linux-kernel

On Wed, Mar 15, 2023 at 7:19 PM Waiman Long <longman@redhat.com> wrote:
>
> How about adding the following fixes tag?
>
> Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups")

SGTM, thanks Waiman!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-16 18:52     ` Josh Don
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Don @ 2023-03-16 18:52 UTC (permalink / raw)
  To: Waiman Long
  Cc: Tejun Heo, Zefan Li, Johannes Weiner,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, Mar 15, 2023 at 7:19 PM Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>
> How about adding the following fixes tag?
>
> Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups")

SGTM, thanks Waiman!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-17 22:20   ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2023-03-17 22:20 UTC (permalink / raw)
  To: Josh Don; +Cc: Zefan Li, Johannes Weiner, cgroups, linux-kernel

On Wed, Mar 15, 2023 at 02:40:29PM -0700, Josh Don wrote:
> 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 <joshdon@google.com>

Applied to cgroup/for-6.3-fixes w/ Fixes tag added and stable cc'd.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cgroup: fix display of forceidle time at root
@ 2023-03-17 22:20   ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2023-03-17 22:20 UTC (permalink / raw)
  To: Josh Don
  Cc: Zefan Li, Johannes Weiner, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, Mar 15, 2023 at 02:40:29PM -0700, Josh Don wrote:
> 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 <joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

Applied to cgroup/for-6.3-fixes w/ Fixes tag added and stable cc'd.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-17 22:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 21:40 [PATCH] cgroup: fix display of forceidle time at root Josh Don
2023-03-15 21:40 ` Josh Don
2023-03-16  2:19 ` Waiman Long
2023-03-16 18:52   ` Josh Don
2023-03-16 18:52     ` Josh Don
2023-03-17 22:20 ` Tejun Heo
2023-03-17 22:20   ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.