aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorHonglei Wang <wanghonglei@didichuxing.com>2022-01-13 21:39:20 +0800
committerPeter Zijlstra <peterz@infradead.org>2022-01-27 12:57:18 +0100
commit12bf8a7eb84e4d3547ebfd89bb0a9255a0f2acc7 (patch)
treecf406039f0c4b2745dd05ed8e55a8b845a299ae7 /kernel/sched/fair.c
parentsched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa (diff)
downloadlinux-dev-12bf8a7eb84e4d3547ebfd89bb0a9255a0f2acc7.tar.xz
linux-dev-12bf8a7eb84e4d3547ebfd89bb0a9255a0f2acc7.zip
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
Diffstat (limited to '')
-rw-r--r--kernel/sched/fair.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 095b0aa378df..5dca13ff89f2 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;