diff options
author | Srikar Dronamraju <srikar@linux.vnet.ibm.com> | 2015-06-25 13:21:43 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-07-04 04:04:33 -0400 |
commit | 397f2378f136128623fc237746157aa2564d1082 (patch) | |
tree | 8a7f246250fd2733a98192c1b0ca6cf66e276e6b /kernel/sched/debug.c | |
parent | e3d24d0a6048a826de5562d75dedb664d3a2a1b2 (diff) |
sched/numa: Fix numa balancing stats in /proc/pid/sched
Commit 44dba3d5d6a1 ("sched: Refactor task_struct to use
numa_faults instead of numa_* pointers") modified the way
tsk->numa_faults stats are accounted.
However that commit never touched show_numa_stats() that is displayed
in /proc/pid/sched and thus the numbers displayed in /proc/pid/sched
don't match the actual numbers.
Fix it by making sure that /proc/pid/sched reflects the task
fault numbers. Also add group fault stats too.
Also couple of more modifications are added here:
1. Format changes:
- Previously we would list two entries per node, one for private
and one for shared. Also the home node info was listed in each entry.
- Now preferred node, total_faults and current node are
displayed separately.
- Now there is one entry per node, that lists private,shared task and
group faults.
2. Unit changes:
- p->numa_pages_migrated was getting reset after every read of
/proc/pid/sched. It's more useful to have absolute numbers since
differential migrations between two accesses can be more easily
calculated.
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Iulia Manda <iulia.manda21@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435252903-1081-4-git-send-email-srikar@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/debug.c')
-rw-r--r-- | kernel/sched/debug.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f1dcd1d390c1..4222ec50ab88 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -517,11 +517,21 @@ __initcall(init_sched_debug_procfs); | |||
517 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) | 517 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) |
518 | 518 | ||
519 | 519 | ||
520 | #ifdef CONFIG_NUMA_BALANCING | ||
521 | void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, | ||
522 | unsigned long tpf, unsigned long gsf, unsigned long gpf) | ||
523 | { | ||
524 | SEQ_printf(m, "numa_faults node=%d ", node); | ||
525 | SEQ_printf(m, "task_private=%lu task_shared=%lu ", tsf, tpf); | ||
526 | SEQ_printf(m, "group_private=%lu group_shared=%lu\n", gsf, gpf); | ||
527 | } | ||
528 | #endif | ||
529 | |||
530 | |||
520 | static void sched_show_numa(struct task_struct *p, struct seq_file *m) | 531 | static void sched_show_numa(struct task_struct *p, struct seq_file *m) |
521 | { | 532 | { |
522 | #ifdef CONFIG_NUMA_BALANCING | 533 | #ifdef CONFIG_NUMA_BALANCING |
523 | struct mempolicy *pol; | 534 | struct mempolicy *pol; |
524 | int node, i; | ||
525 | 535 | ||
526 | if (p->mm) | 536 | if (p->mm) |
527 | P(mm->numa_scan_seq); | 537 | P(mm->numa_scan_seq); |
@@ -533,26 +543,12 @@ static void sched_show_numa(struct task_struct *p, struct seq_file *m) | |||
533 | mpol_get(pol); | 543 | mpol_get(pol); |
534 | task_unlock(p); | 544 | task_unlock(p); |
535 | 545 | ||
536 | SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); | 546 | P(numa_pages_migrated); |
537 | 547 | P(numa_preferred_nid); | |
538 | for_each_online_node(node) { | 548 | P(total_numa_faults); |
539 | for (i = 0; i < 2; i++) { | 549 | SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", |
540 | unsigned long nr_faults = -1; | 550 | task_node(p), task_numa_group_id(p)); |
541 | int cpu_current, home_node; | 551 | show_numa_stats(p, m); |
542 | |||
543 | if (p->numa_faults) | ||
544 | nr_faults = p->numa_faults[2*node + i]; | ||
545 | |||
546 | cpu_current = !i ? (task_node(p) == node) : | ||
547 | (pol && node_isset(node, pol->v.nodes)); | ||
548 | |||
549 | home_node = (p->numa_preferred_nid == node); | ||
550 | |||
551 | SEQ_printf(m, "numa_faults_memory, %d, %d, %d, %d, %ld\n", | ||
552 | i, node, cpu_current, home_node, nr_faults); | ||
553 | } | ||
554 | } | ||
555 | |||
556 | mpol_put(pol); | 552 | mpol_put(pol); |
557 | #endif | 553 | #endif |
558 | } | 554 | } |