History

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.

Honglei Wang committed 4 years ago

Commit 12bf8a71 parent 28c988c1 file · +2 −0Browse files

Unified · Split

kernel/sched/fair.c+2−0
@@ -2825,6 +2825,8 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p) · 2824 unmodified lines
2825 /* Protect against double add, see task_tick_numa and task_numa_work */2825 /* Protect against double add, see task_tick_numa and task_numa_work */
2826 p->numa_work.next = &p->numa_work;2826 p->numa_work.next = &p->numa_work;
2827 p->numa_faults = NULL;2827 p->numa_faults = NULL;
2828 p->numa_pages_migrated = 0;
2829 p->total_numa_faults = 0;
2828 RCU_INIT_POINTER(p->numa_group, NULL);2830 RCU_INIT_POINTER(p->numa_group, NULL);
2829 p->last_task_numa_placement = 0;2831 p->last_task_numa_placement = 0;
2830 p->last_sum_exec_runtime = 0;2832 p->last_sum_exec_runtime = 0;