sched/numa: Detect 'big' processes
Commit-ID: 1b9fc936e56d62dfbb12ab4651c0432e91c10e2a Gitweb: http://git.kernel.org/tip/1b9fc936e56d62dfbb12ab4651c0432e91c10e2a Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 16 Jul 2012 13:08:54 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 27 Sep 2012 17:04:48 +0200
sched/numa: Detect 'big' processes
Detect 'big' processes for which the one home-node per process isn't going to work as desired.
The current policy for such tasks is to ignore them entirely and put the home-node back to -1 (no preference) so they'll behave as if none of this NUMA home node awareness is there.
The current heuristic for determining if a task is 'big' is if its consuming more than 1/2 a node's worth of cputime. We might want to add a term here looking at the RSS of the process and compare this against the available memory per node.
Since we now do multiple things from the task_work thing, we need to extend the state to determine which of the things we're there for -- a change in numa node, or a periodic poll of 'big'-ness.
--- include/linux/mm_types.h | 1 + include/linux/sched.h | 4 +- kernel/sched/core.c | 12 ++++-- kernel/sched/fair.c | 96 ++++++++++++++++++++++++++++++++++++++------- 4 files changed, 93 insertions(+), 20 deletions(-)
include/linux/mm_types.h +1 -0
@@ -405,6 +405,7 @@ struct mm_struct {struct cpumask cpumask_allocation;#endif #ifdef CONFIG_SCHED_NUMA +unsigned int numa_big;unsigned long numa_next_scan;#endif struct uprobes_state uprobes_state;
include/linux/sched.h +3 -1
@@ -1521,8 +1521,10 @@ struct task_struct {#endif #ifdef CONFIG_SCHED_NUMA int node;/* task home node */ -int node_last;/* home node filter */ +int node_curr, node_last;/* home node filter */ u64 node_stamp;/* migration stamp */ +u64 numa_runtime_stamp; +u64 numa_walltime_stamp;unsigned long numa_contrib;#endif /* CONFIG_SCHED_NUMA */
kernel/sched/core.c +8 -4
@@ -1535,13 +1535,18 @@ static void __sched_fork(struct task_struct *p)#endif #ifdef CONFIG_SCHED_NUMA -if (p->mm &&atomic_read (&p->mm->mm_users) ==1 ) +if (p->mm &&atomic_read (&p->mm->mm_users) ==1 ) { + p->mm->numa_big =0 ; p->mm->numa_next_scan = jiffies; + } p->node =-1 ; + p->node_curr =-1 ; p->node_last =-1 ; p->node_stamp =0ULL ; -#endif /* CONFIG_NUMA */ + p->numa_runtime_stamp =0 ; + p->numa_walltime_stamp =local_clock (); +#endif /* CONFIG_SCHED_NUMA */ }/*
@@ -6024,8 +6029,7 @@ void sched_setnode(struct task_struct *p, int node)if (running) p->sched_class->put_prev_task (rq, p); - p->node = node; - p->node_last = node; + p->node = p->node_curr = p->node_last = node;if (running) p->sched_class->set_curr_task (rq);
kernel/sched/fair.c +81 -15
137 lines not on this page · raw message