* [PATCH 0/3] sched/numa: Update numa_balancing stats in /proc
@ 2015-06-25 17:21 Srikar Dronamraju
2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Srikar Dronamraju @ 2015-06-25 17:21 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra
Cc: linux-kernel, srikar, Rik van Riel, Mel Gorman, Iulia Manda
Recent changes to numa balancing like adding group faults, merging
numa_faults and numa_mem_faults have not been reflected in /proc.
Hence some of the numa_balancing information is not exposed or displays
wrong info. This patchset tries to correct it.
Before change: /proc/pid/sched
clock-delta : 12
mm->numa_scan_seq : 34
numa_migrations, 1
numa_faults_memory, 0, 0, 1, 0, -1
numa_faults_memory, 1, 0, 0, 0, -1
numa_faults_memory, 0, 1, 0, 0, -1
numa_faults_memory, 1, 1, 0, 0, -1
numa_faults_memory, 0, 2, 0, 0, -1
numa_faults_memory, 1, 2, 0, 0, -1
numa_faults_memory, 0, 3, 0, 0, -1
numa_faults_memory, 1, 3, 0, 0, -1
After change: /proc/pid/sched
clock-delta : 12
mm->numa_scan_seq : 34
numa_pages_migrated : 1
numa_preferred_nid : 0
total_numa_faults : 2627
current_node=0, numa_group_id=6958
numa_faults node=0 task_private=1344 task_shared=0 group_private=1344 group_shared=0
numa_faults node=1 task_private=641 task_shared=65 group_private=641 group_shared=65
numa_faults node=2 task_private=512 task_shared=0 group_private=512 group_shared=0
numa_faults node=3 task_private=64 task_shared=1 group_private=64 group_shared=1
Srikar Dronamraju (3):
sched: Move print_cfs_rq declaration to kernel/sched/sched.h
sched/numa: Show numa_group id in sched_debug task listings
sched/numa: Fix numabalancing stats in /proc/pid/sched
include/linux/sched.h | 2 --
kernel/sched/debug.c | 40 ++++++++++++++++++----------------------
kernel/sched/fair.c | 22 +++++++++++++++++++++-
kernel/sched/sched.h | 13 +++++++++++++
4 files changed, 52 insertions(+), 25 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h 2015-06-25 17:21 [PATCH 0/3] sched/numa: Update numa_balancing stats in /proc Srikar Dronamraju @ 2015-06-25 17:21 ` Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel ` (2 more replies) 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju 2 siblings, 3 replies; 13+ messages in thread From: Srikar Dronamraju @ 2015-06-25 17:21 UTC (permalink / raw) To: Ingo Molnar, Peter Zijlstra Cc: linux-kernel, srikar, Rik van Riel, Mel Gorman, Iulia Manda Currently print_cfs_rq() is declared in include/linux/sched.h. However its not used outside kernel/sched. Hence move the declaration to kernel/sched/sched.h Also some functions are only available for CONFIG_SCHED_DEBUG. Hence move the declarations within #ifdef. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> --- include/linux/sched.h | 2 -- kernel/sched/sched.h | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 6633e83..eb5d5ff 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -191,8 +191,6 @@ struct task_group; #ifdef CONFIG_SCHED_DEBUG extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); extern void proc_sched_set_task(struct task_struct *p); -extern void -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); #endif /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 8858891..c901c9c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1689,9 +1689,14 @@ static inline void double_rq_unlock(struct rq *rq1, struct rq *rq2) extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq); extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq); + +#ifdef CONFIG_SCHED_DEBUG extern void print_cfs_stats(struct seq_file *m, int cpu); extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); +extern void +print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); +#endif extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju @ 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:46 ` [tip:sched/urgent] sched/debug: Move print_cfs_rq() " tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: Rik van Riel @ 2015-06-25 17:39 UTC (permalink / raw) To: Srikar Dronamraju, Ingo Molnar, Peter Zijlstra Cc: linux-kernel, Mel Gorman, Iulia Manda On 06/25/2015 01:21 PM, Srikar Dronamraju wrote: > Currently print_cfs_rq() is declared in include/linux/sched.h. > However its not used outside kernel/sched. Hence move the declaration to > kernel/sched/sched.h > > Also some functions are only available for CONFIG_SCHED_DEBUG. Hence move > the declarations within #ifdef. > > Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Rik van Riel <riel@redhat.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/debug: Move print_cfs_rq() declaration to kernel/sched/sched.h 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel @ 2015-07-03 7:46 ` tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-03 7:46 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, torvalds, mingo, tglx, srikar, peterz, hpa, mgorman, riel, iulia.manda21 Commit-ID: 6e3ecb4945f06ebbf1cf00ec316511c249492b08 Gitweb: http://git.kernel.org/tip/6e3ecb4945f06ebbf1cf00ec316511c249492b08 Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:41 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Wed, 1 Jul 2015 10:31:27 +0200 sched/debug: Move print_cfs_rq() declaration to kernel/sched/sched.h Currently print_cfs_rq() is declared in include/linux/sched.h. However it's not used outside kernel/sched. Hence move the declaration to kernel/sched/sched.h Also some functions are only available for CONFIG_SCHED_DEBUG=y. Hence move the declarations to within the #ifdef. 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-2-git-send-email-srikar@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- include/linux/sched.h | 2 -- kernel/sched/sched.h | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 9bf4bc0..3505352 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -191,8 +191,6 @@ struct task_group; #ifdef CONFIG_SCHED_DEBUG extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); extern void proc_sched_set_task(struct task_struct *p); -extern void -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); #endif /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index aea7c1f..7d58952 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1668,9 +1668,14 @@ static inline void double_rq_unlock(struct rq *rq1, struct rq *rq2) extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq); extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq); + +#ifdef CONFIG_SCHED_DEBUG extern void print_cfs_stats(struct seq_file *m, int cpu); extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); +extern void +print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); +#endif extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/debug: Move print_cfs_rq() declaration to kernel/sched/sched.h 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:46 ` [tip:sched/urgent] sched/debug: Move print_cfs_rq() " tip-bot for Srikar Dronamraju @ 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-04 8:07 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, iulia.manda21, mgorman, mingo, tglx, srikar, riel, peterz, torvalds Commit-ID: 6b55c9654fccf69ae7ace23ca101dc37b903181b Gitweb: http://git.kernel.org/tip/6b55c9654fccf69ae7ace23ca101dc37b903181b Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:41 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Sat, 4 Jul 2015 10:04:31 +0200 sched/debug: Move print_cfs_rq() declaration to kernel/sched/sched.h Currently print_cfs_rq() is declared in include/linux/sched.h. However it's not used outside kernel/sched. Hence move the declaration to kernel/sched/sched.h Also some functions are only available for CONFIG_SCHED_DEBUG=y. Hence move the declarations to within the #ifdef. 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-2-git-send-email-srikar@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- include/linux/sched.h | 2 -- kernel/sched/sched.h | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 9bf4bc0..3505352 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -191,8 +191,6 @@ struct task_group; #ifdef CONFIG_SCHED_DEBUG extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); extern void proc_sched_set_task(struct task_struct *p); -extern void -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); #endif /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index aea7c1f..7d58952 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1668,9 +1668,14 @@ static inline void double_rq_unlock(struct rq *rq1, struct rq *rq2) extern struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq); extern struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq); + +#ifdef CONFIG_SCHED_DEBUG extern void print_cfs_stats(struct seq_file *m, int cpu); extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); +extern void +print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); +#endif extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings 2015-06-25 17:21 [PATCH 0/3] sched/numa: Update numa_balancing stats in /proc Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju @ 2015-06-25 17:21 ` Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel ` (2 more replies) 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju 2 siblings, 3 replies; 13+ messages in thread From: Srikar Dronamraju @ 2015-06-25 17:21 UTC (permalink / raw) To: Ingo Molnar, Peter Zijlstra Cc: linux-kernel, srikar, Rik van Riel, Mel Gorman, Iulia Manda Having the numa group id in /proc/sched_debug helps to see how the numa groups have spread across the system. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> --- kernel/sched/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 315c68e..f1dcd1d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -142,7 +142,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 0LL, 0L); #endif #ifdef CONFIG_NUMA_BALANCING - SEQ_printf(m, " %d", task_node(p)); + SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); #endif #ifdef CONFIG_CGROUP_SCHED SEQ_printf(m, " %s", task_group_path(task_group(p))); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju @ 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Show numa_group ID in /proc/ " tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: Rik van Riel @ 2015-06-25 17:39 UTC (permalink / raw) To: Srikar Dronamraju, Ingo Molnar, Peter Zijlstra Cc: linux-kernel, Mel Gorman, Iulia Manda On 06/25/2015 01:21 PM, Srikar Dronamraju wrote: > Having the numa group id in /proc/sched_debug helps to see how the numa > groups have spread across the system. > > Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Rik van Riel <riel@redhat.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/numa: Show numa_group ID in /proc/ sched_debug task listings 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel @ 2015-07-03 7:47 ` tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-03 7:47 UTC (permalink / raw) To: linux-tip-commits Cc: mgorman, hpa, peterz, iulia.manda21, riel, srikar, tglx, mingo, linux-kernel, torvalds Commit-ID: 478fd9ada06ff17ae13a5b7f775346562036127e Gitweb: http://git.kernel.org/tip/478fd9ada06ff17ae13a5b7f775346562036127e Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:42 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Wed, 1 Jul 2015 10:31:27 +0200 sched/numa: Show numa_group ID in /proc/sched_debug task listings Having the numa group ID in /proc/sched_debug helps to see how the numa groups have spread across the system. 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-3-git-send-email-srikar@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- kernel/sched/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 315c68e..f1dcd1d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -142,7 +142,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 0LL, 0L); #endif #ifdef CONFIG_NUMA_BALANCING - SEQ_printf(m, " %d", task_node(p)); + SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); #endif #ifdef CONFIG_CGROUP_SCHED SEQ_printf(m, " %s", task_group_path(task_group(p))); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/numa: Show numa_group ID in /proc/ sched_debug task listings 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Show numa_group ID in /proc/ " tip-bot for Srikar Dronamraju @ 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-04 8:07 UTC (permalink / raw) To: linux-tip-commits Cc: mgorman, riel, linux-kernel, peterz, hpa, srikar, torvalds, tglx, mingo, iulia.manda21 Commit-ID: e3d24d0a6048a826de5562d75dedb664d3a2a1b2 Gitweb: http://git.kernel.org/tip/e3d24d0a6048a826de5562d75dedb664d3a2a1b2 Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:42 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Sat, 4 Jul 2015 10:04:32 +0200 sched/numa: Show numa_group ID in /proc/sched_debug task listings Having the numa group ID in /proc/sched_debug helps to see how the numa groups have spread across the system. 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-3-git-send-email-srikar@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- kernel/sched/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 315c68e..f1dcd1d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -142,7 +142,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 0LL, 0L); #endif #ifdef CONFIG_NUMA_BALANCING - SEQ_printf(m, " %d", task_node(p)); + SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); #endif #ifdef CONFIG_CGROUP_SCHED SEQ_printf(m, " %s", task_group_path(task_group(p))); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched 2015-06-25 17:21 [PATCH 0/3] sched/numa: Update numa_balancing stats in /proc Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju @ 2015-06-25 17:21 ` Srikar Dronamraju 2015-06-25 17:40 ` Rik van Riel ` (2 more replies) 2 siblings, 3 replies; 13+ messages in thread From: Srikar Dronamraju @ 2015-06-25 17:21 UTC (permalink / raw) To: Ingo Molnar, Peter Zijlstra Cc: linux-kernel, srikar, Rik van Riel, Mel Gorman, Iulia Manda 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 displays /proc/pid/sched. Now the numbers displayed in /proc/pid/sched dont 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 change. - 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. p->numa_pages_migrated was getting reset after every read of /proc/pid/sched. Its more useful to have absolute numbers since differential migrations between two accesses can be easily calculated. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> --- kernel/sched/debug.c | 38 +++++++++++++++++--------------------- kernel/sched/fair.c | 22 +++++++++++++++++++++- kernel/sched/sched.h | 10 +++++++++- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f1dcd1d..8b974ed 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -517,11 +517,21 @@ __initcall(init_sched_debug_procfs); SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) +#ifdef CONFIG_NUMA_BALANCING +void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf) +{ + SEQ_printf(m, "numa_faults node=%d ", node); + SEQ_printf(m, "task_private=%lu task_shared=%lu ", tsf, tpf); + SEQ_printf(m, "group_private=%lu group_shared=%lu\n", gsf, gpf); +} +#endif + + static void sched_show_numa(struct task_struct *p, struct seq_file *m) { #ifdef CONFIG_NUMA_BALANCING struct mempolicy *pol; - int node, i; if (p->mm) P(mm->numa_scan_seq); @@ -533,26 +543,12 @@ static void sched_show_numa(struct task_struct *p, struct seq_file *m) mpol_get(pol); task_unlock(p); - SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); - - for_each_online_node(node) { - for (i = 0; i < 2; i++) { - unsigned long nr_faults = -1; - int cpu_current, home_node; - - if (p->numa_faults) - nr_faults = p->numa_faults[2*node + i]; - - cpu_current = !i ? (task_node(p) == node) : - (pol && node_isset(node, pol->v.nodes)); - - home_node = (p->numa_preferred_nid == node); - - SEQ_printf(m, "numa_faults_memory, %d, %d, %d, %d, %ld\n", - i, node, cpu_current, home_node, nr_faults); - } - } - + P(numa_pages_migrated); + P(numa_preferred_nid); + P(total_numa_faults); + SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", + task_node(p), task_numa_group_id(p)); + show_numa_stats(p, m); mpol_put(pol); #endif } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3d57cc0..e31ece1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8473,7 +8473,27 @@ void print_cfs_stats(struct seq_file *m, int cpu) print_cfs_rq(m, cpu, cfs_rq); rcu_read_unlock(); } -#endif + +#ifdef CONFIG_NUMA_BALANCING +void show_numa_stats(struct task_struct *p, struct seq_file *m) +{ + int node; + unsigned long tsf = 0, tpf = 0, gsf = 0, gpf = 0; + + for_each_online_node(node) { + if (p->numa_faults) { + tsf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 0)]; + tpf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + if (p->numa_group) { + gsf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 0)], + gpf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + print_numa_stats(m, node, tsf, tpf, gsf, gpf); + } +} +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ __init void init_sched_fair_class(void) { diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index c901c9c..84d4879 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1696,7 +1696,15 @@ extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); extern void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); -#endif + +#ifdef CONFIG_NUMA_BALANCING +extern void +show_numa_stats(struct task_struct *p, struct seq_file *m); +extern void +print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf); +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju @ 2015-06-25 17:40 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Fix numa balancing stats in /proc/ pid/sched tip-bot for Srikar Dronamraju 2015-07-04 8:08 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: Rik van Riel @ 2015-06-25 17:40 UTC (permalink / raw) To: Srikar Dronamraju, Ingo Molnar, Peter Zijlstra Cc: linux-kernel, Mel Gorman, Iulia Manda On 06/25/2015 01:21 PM, Srikar Dronamraju wrote: > 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 > displays /proc/pid/sched. Now the numbers displayed in /proc/pid/sched > dont 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 change. > - 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. p->numa_pages_migrated was getting reset after every read of > /proc/pid/sched. Its more useful to have absolute numbers since > differential migrations between two accesses can be easily calculated. > > Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Rik van Riel <riel@redhat.com> Thank you for updating the statistics to match what the code does nowadays. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/numa: Fix numa balancing stats in /proc/ pid/sched 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju 2015-06-25 17:40 ` Rik van Riel @ 2015-07-03 7:47 ` tip-bot for Srikar Dronamraju 2015-07-04 8:08 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-03 7:47 UTC (permalink / raw) To: linux-tip-commits Cc: mingo, srikar, tglx, iulia.manda21, mgorman, peterz, linux-kernel, riel, torvalds, hpa Commit-ID: 46fb6b9762d13fdeeefb3a9e9c317ebcd344f578 Gitweb: http://git.kernel.org/tip/46fb6b9762d13fdeeefb3a9e9c317ebcd344f578 Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:43 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Wed, 1 Jul 2015 10:31:28 +0200 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> --- kernel/sched/debug.c | 38 +++++++++++++++++--------------------- kernel/sched/fair.c | 22 +++++++++++++++++++++- kernel/sched/sched.h | 10 +++++++++- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f1dcd1d..4222ec5 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -517,11 +517,21 @@ __initcall(init_sched_debug_procfs); SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) +#ifdef CONFIG_NUMA_BALANCING +void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf) +{ + SEQ_printf(m, "numa_faults node=%d ", node); + SEQ_printf(m, "task_private=%lu task_shared=%lu ", tsf, tpf); + SEQ_printf(m, "group_private=%lu group_shared=%lu\n", gsf, gpf); +} +#endif + + static void sched_show_numa(struct task_struct *p, struct seq_file *m) { #ifdef CONFIG_NUMA_BALANCING struct mempolicy *pol; - int node, i; if (p->mm) P(mm->numa_scan_seq); @@ -533,26 +543,12 @@ static void sched_show_numa(struct task_struct *p, struct seq_file *m) mpol_get(pol); task_unlock(p); - SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); - - for_each_online_node(node) { - for (i = 0; i < 2; i++) { - unsigned long nr_faults = -1; - int cpu_current, home_node; - - if (p->numa_faults) - nr_faults = p->numa_faults[2*node + i]; - - cpu_current = !i ? (task_node(p) == node) : - (pol && node_isset(node, pol->v.nodes)); - - home_node = (p->numa_preferred_nid == node); - - SEQ_printf(m, "numa_faults_memory, %d, %d, %d, %d, %ld\n", - i, node, cpu_current, home_node, nr_faults); - } - } - + P(numa_pages_migrated); + P(numa_preferred_nid); + P(total_numa_faults); + SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", + task_node(p), task_numa_group_id(p)); + show_numa_stats(p, m); mpol_put(pol); #endif } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 40a7fcb..7245039 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8468,7 +8468,27 @@ void print_cfs_stats(struct seq_file *m, int cpu) print_cfs_rq(m, cpu, cfs_rq); rcu_read_unlock(); } -#endif + +#ifdef CONFIG_NUMA_BALANCING +void show_numa_stats(struct task_struct *p, struct seq_file *m) +{ + int node; + unsigned long tsf = 0, tpf = 0, gsf = 0, gpf = 0; + + for_each_online_node(node) { + if (p->numa_faults) { + tsf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 0)]; + tpf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + if (p->numa_group) { + gsf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 0)], + gpf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + print_numa_stats(m, node, tsf, tpf, gsf, gpf); + } +} +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ __init void init_sched_fair_class(void) { diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7d58952..7ef5968 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1675,7 +1675,15 @@ extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); extern void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); -#endif + +#ifdef CONFIG_NUMA_BALANCING +extern void +show_numa_stats(struct task_struct *p, struct seq_file *m); +extern void +print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf); +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:sched/urgent] sched/numa: Fix numa balancing stats in /proc/ pid/sched 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju 2015-06-25 17:40 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Fix numa balancing stats in /proc/ pid/sched tip-bot for Srikar Dronamraju @ 2015-07-04 8:08 ` tip-bot for Srikar Dronamraju 2 siblings, 0 replies; 13+ messages in thread From: tip-bot for Srikar Dronamraju @ 2015-07-04 8:08 UTC (permalink / raw) To: linux-tip-commits Cc: torvalds, mingo, tglx, riel, mgorman, srikar, hpa, peterz, iulia.manda21, linux-kernel Commit-ID: 397f2378f136128623fc237746157aa2564d1082 Gitweb: http://git.kernel.org/tip/397f2378f136128623fc237746157aa2564d1082 Author: Srikar Dronamraju <srikar@linux.vnet.ibm.com> AuthorDate: Thu, 25 Jun 2015 22:51:43 +0530 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Sat, 4 Jul 2015 10:04:33 +0200 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> --- kernel/sched/debug.c | 38 +++++++++++++++++--------------------- kernel/sched/fair.c | 22 +++++++++++++++++++++- kernel/sched/sched.h | 10 +++++++++- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f1dcd1d..4222ec5 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -517,11 +517,21 @@ __initcall(init_sched_debug_procfs); SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) +#ifdef CONFIG_NUMA_BALANCING +void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf) +{ + SEQ_printf(m, "numa_faults node=%d ", node); + SEQ_printf(m, "task_private=%lu task_shared=%lu ", tsf, tpf); + SEQ_printf(m, "group_private=%lu group_shared=%lu\n", gsf, gpf); +} +#endif + + static void sched_show_numa(struct task_struct *p, struct seq_file *m) { #ifdef CONFIG_NUMA_BALANCING struct mempolicy *pol; - int node, i; if (p->mm) P(mm->numa_scan_seq); @@ -533,26 +543,12 @@ static void sched_show_numa(struct task_struct *p, struct seq_file *m) mpol_get(pol); task_unlock(p); - SEQ_printf(m, "numa_migrations, %ld\n", xchg(&p->numa_pages_migrated, 0)); - - for_each_online_node(node) { - for (i = 0; i < 2; i++) { - unsigned long nr_faults = -1; - int cpu_current, home_node; - - if (p->numa_faults) - nr_faults = p->numa_faults[2*node + i]; - - cpu_current = !i ? (task_node(p) == node) : - (pol && node_isset(node, pol->v.nodes)); - - home_node = (p->numa_preferred_nid == node); - - SEQ_printf(m, "numa_faults_memory, %d, %d, %d, %d, %ld\n", - i, node, cpu_current, home_node, nr_faults); - } - } - + P(numa_pages_migrated); + P(numa_preferred_nid); + P(total_numa_faults); + SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", + task_node(p), task_numa_group_id(p)); + show_numa_stats(p, m); mpol_put(pol); #endif } diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 40a7fcb..7245039 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8468,7 +8468,27 @@ void print_cfs_stats(struct seq_file *m, int cpu) print_cfs_rq(m, cpu, cfs_rq); rcu_read_unlock(); } -#endif + +#ifdef CONFIG_NUMA_BALANCING +void show_numa_stats(struct task_struct *p, struct seq_file *m) +{ + int node; + unsigned long tsf = 0, tpf = 0, gsf = 0, gpf = 0; + + for_each_online_node(node) { + if (p->numa_faults) { + tsf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 0)]; + tpf = p->numa_faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + if (p->numa_group) { + gsf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 0)], + gpf = p->numa_group->faults[task_faults_idx(NUMA_MEM, node, 1)]; + } + print_numa_stats(m, node, tsf, tpf, gsf, gpf); + } +} +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ __init void init_sched_fair_class(void) { diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7d58952..7ef5968 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1675,7 +1675,15 @@ extern void print_rt_stats(struct seq_file *m, int cpu); extern void print_dl_stats(struct seq_file *m, int cpu); extern void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); -#endif + +#ifdef CONFIG_NUMA_BALANCING +extern void +show_numa_stats(struct task_struct *p, struct seq_file *m); +extern void +print_numa_stats(struct seq_file *m, int node, unsigned long tsf, + unsigned long tpf, unsigned long gsf, unsigned long gpf); +#endif /* CONFIG_NUMA_BALANCING */ +#endif /* CONFIG_SCHED_DEBUG */ extern void init_cfs_rq(struct cfs_rq *cfs_rq); extern void init_rt_rq(struct rt_rq *rt_rq); ^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-07-05 8:36 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-25 17:21 [PATCH 0/3] sched/numa: Update numa_balancing stats in /proc Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 1/3] sched: Move print_cfs_rq declaration to kernel/sched/sched.h Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:46 ` [tip:sched/urgent] sched/debug: Move print_cfs_rq() " tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 2/3] sched/numa: Show numa_group id in sched_debug task listings Srikar Dronamraju 2015-06-25 17:39 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Show numa_group ID in /proc/ " tip-bot for Srikar Dronamraju 2015-07-04 8:07 ` tip-bot for Srikar Dronamraju 2015-06-25 17:21 ` [PATCH 3/3] sched/numa: Fix numabalancing stats in /proc/pid/sched Srikar Dronamraju 2015-06-25 17:40 ` Rik van Riel 2015-07-03 7:47 ` [tip:sched/urgent] sched/numa: Fix numa balancing stats in /proc/ pid/sched tip-bot for Srikar Dronamraju 2015-07-04 8:08 ` tip-bot for Srikar Dronamraju
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox