All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/numa: initialize numa statistics when forking new task
@ 2022-01-13 13:39 Honglei Wang
  2022-01-17 15:45 ` Honglei Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Honglei Wang @ 2022-01-13 13:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, linux-kernel
  Cc: Honglei Wang

The child processes will inherit numa_pages_migrated and
total_numa_faults from the parent. It means even if there is no numa
fault happen on the child, the statistics in /proc/$pid of the child
process might show huge amount. This is a bit weird. Let's initialize
them when do fork.

Signed-off-by: Honglei Wang <wanghonglei@didichuxing.com>
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6e476f6d9435..1aa0ec123a4b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2826,6 +2826,8 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
 	/* Protect against double add, see task_tick_numa and task_numa_work */
 	p->numa_work.next		= &p->numa_work;
 	p->numa_faults			= NULL;
+	p->numa_pages_migrated		= 0;
+	p->total_numa_faults		= 0;
 	RCU_INIT_POINTER(p->numa_group, NULL);
 	p->last_task_numa_placement	= 0;
 	p->last_sum_exec_runtime	= 0;
-- 
2.14.1


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

* Re:[PATCH] sched/numa: initialize numa statistics when forking new task
  2022-01-13 13:39 [PATCH] sched/numa: initialize numa statistics when forking new task Honglei Wang
@ 2022-01-17 15:45 ` Honglei Wang
  2022-01-17 16:18   ` [PATCH] " Honglei Wang
  2022-01-18 10:39 ` Mel Gorman
  2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Honglei Wang
  2 siblings, 1 reply; 5+ messages in thread
From: Honglei Wang @ 2022-01-17 15:45 UTC (permalink / raw)
  To: Honglei Wang
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, linux-kernel, wanghonglei

Hello, friendly ping... any comments about this?

At 2022-01-13 21:39:20, "Honglei Wang" <wanghonglei@didichuxing.com> wrote:
>The child processes will inherit numa_pages_migrated and
>total_numa_faults from the parent. It means even if there is no numa
>fault happen on the child, the statistics in /proc/$pid of the child
>process might show huge amount. This is a bit weird. Let's initialize
>them when do fork.
>
>Signed-off-by: Honglei Wang <wanghonglei@didichuxing.com>
>---
> kernel/sched/fair.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>index 6e476f6d9435..1aa0ec123a4b 100644
>--- a/kernel/sched/fair.c
>+++ b/kernel/sched/fair.c
>@@ -2826,6 +2826,8 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
> 	/* Protect against double add, see task_tick_numa and task_numa_work */
> 	p->numa_work.next		= &p->numa_work;
> 	p->numa_faults			= NULL;
>+	p->numa_pages_migrated		= 0;
>+	p->total_numa_faults		= 0;
> 	RCU_INIT_POINTER(p->numa_group, NULL);
> 	p->last_task_numa_placement	= 0;
> 	p->last_sum_exec_runtime	= 0;
>-- 
>2.14.1

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

* Re: [PATCH] sched/numa: initialize numa statistics when forking new task
  2022-01-17 15:45 ` Honglei Wang
@ 2022-01-17 16:18   ` Honglei Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Honglei Wang @ 2022-01-17 16:18 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Steven Rostedt, Juri Lelli,
	Dietmar Eggemann, Vincent Guittot, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, linux-kernel
  Cc: Honglei Wang

Hello, friendly ping... any comments about this?

At 2022-01-13 21:39:20, "Honglei Wang" <wanghonglei@didichuxing.com> wrote:
> The child processes will inherit numa_pages_migrated and
> total_numa_faults from the parent. It means even if there is no numa
> fault happen on the child, the statistics in /proc/$pid of the child
> process might show huge amount. This is a bit weird. Let's initialize
> them when do fork.
>
> Signed-off-by: Honglei Wang <wanghonglei@didichuxing.com>
> ---
>   kernel/sched/fair.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 6e476f6d9435..1aa0ec123a4b 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2826,6 +2826,8 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
> 	/* Protect against double add, see task_tick_numa and task_numa_work */
> 	p->numa_work.next		= &p->numa_work;
> 	p->numa_faults			= NULL;
> +	p->numa_pages_migrated		= 0;
> +	p->total_numa_faults		= 0;
> 	RCU_INIT_POINTER(p->numa_group, NULL);
> 	p->last_task_numa_placement	= 0;
> 	p->last_sum_exec_runtime	= 0;
> -- 
> 2.14.1

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

* Re: [PATCH] sched/numa: initialize numa statistics when forking new task
  2022-01-13 13:39 [PATCH] sched/numa: initialize numa statistics when forking new task Honglei Wang
  2022-01-17 15:45 ` Honglei Wang
@ 2022-01-18 10:39 ` Mel Gorman
  2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Honglei Wang
  2 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2022-01-18 10:39 UTC (permalink / raw)
  To: Honglei Wang
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Daniel Bristot de Oliveira, linux-kernel, Honglei Wang

On Thu, Jan 13, 2022 at 09:39:20PM +0800, Honglei Wang wrote:
> The child processes will inherit numa_pages_migrated and
> total_numa_faults from the parent. It means even if there is no numa
> fault happen on the child, the statistics in /proc/$pid of the child
> process might show huge amount. This is a bit weird. Let's initialize
> them when do fork.
> 
> Signed-off-by: Honglei Wang <wanghonglei@didichuxing.com>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

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

* [tip: sched/core] sched/numa: initialize numa statistics when forking new task
  2022-01-13 13:39 [PATCH] sched/numa: initialize numa statistics when forking new task Honglei Wang
  2022-01-17 15:45 ` Honglei Wang
  2022-01-18 10:39 ` Mel Gorman
@ 2022-01-28  7:40 ` tip-bot2 for Honglei Wang
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Honglei Wang @ 2022-01-28  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Honglei Wang, Peter Zijlstra (Intel), Mel Gorman, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     12bf8a7eb84e4d3547ebfd89bb0a9255a0f2acc7
Gitweb:        https://git.kernel.org/tip/12bf8a7eb84e4d3547ebfd89bb0a9255a0f2acc7
Author:        Honglei Wang <wanghonglei@didichuxing.com>
AuthorDate:    Thu, 13 Jan 2022 21:39:20 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 27 Jan 2022 12:57:18 +01:00

sched/numa: initialize numa statistics when forking new task

The child processes will inherit numa_pages_migrated and
total_numa_faults from the parent. It means even if there is no numa
fault happen on the child, the statistics in /proc/$pid of the child
process might show huge amount. This is a bit weird. Let's initialize
them when do fork.

Signed-off-by: Honglei Wang <wanghonglei@didichuxing.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lore.kernel.org/r/20220113133920.49900-1-wanghonglei@didichuxing.com
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 095b0aa..5dca13f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2825,6 +2825,8 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
 	/* Protect against double add, see task_tick_numa and task_numa_work */
 	p->numa_work.next		= &p->numa_work;
 	p->numa_faults			= NULL;
+	p->numa_pages_migrated		= 0;
+	p->total_numa_faults		= 0;
 	RCU_INIT_POINTER(p->numa_group, NULL);
 	p->last_task_numa_placement	= 0;
 	p->last_sum_exec_runtime	= 0;

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

end of thread, other threads:[~2022-01-28  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 13:39 [PATCH] sched/numa: initialize numa statistics when forking new task Honglei Wang
2022-01-17 15:45 ` Honglei Wang
2022-01-17 16:18   ` [PATCH] " Honglei Wang
2022-01-18 10:39 ` Mel Gorman
2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Honglei Wang

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.