linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa
@ 2022-01-18  5:05 Bharata B Rao
  2022-01-18  6:58 ` Srikar Dronamraju
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bharata B Rao @ 2022-01-18  5:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, srikar, riel, Bharata B Rao

The older format of /proc/pid/sched printed home node info which
required the mempolicy and task lock around mpol_get(). However
the format has changed since then and there is no need for
sched_show_numa() any more to have mempolicy argument,
asssociated mpol_get/put and task_lock/unlock. Remove them.

Fixes: 397f2378f1361 ("sched/numa: Fix numa balancing stats in /proc/pid/sched")
Signed-off-by: Bharata B Rao <bharata@amd.com>
---
 kernel/sched/debug.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 7dcbaa31c5d9..50e05c8d0d61 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -931,25 +931,15 @@ void print_numa_stats(struct seq_file *m, int node, unsigned long tsf,
 static void sched_show_numa(struct task_struct *p, struct seq_file *m)
 {
 #ifdef CONFIG_NUMA_BALANCING
-	struct mempolicy *pol;
-
 	if (p->mm)
 		P(mm->numa_scan_seq);
 
-	task_lock(p);
-	pol = p->mempolicy;
-	if (pol && !(pol->flags & MPOL_F_MORON))
-		pol = NULL;
-	mpol_get(pol);
-	task_unlock(p);
-
 	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
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa
  2022-01-18  5:05 [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa Bharata B Rao
@ 2022-01-18  6:58 ` Srikar Dronamraju
  2022-01-18 10:20 ` Mel Gorman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Srikar Dronamraju @ 2022-01-18  6:58 UTC (permalink / raw)
  To: Bharata B Rao
  Cc: linux-kernel, mingo, peterz, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, riel

* Bharata B Rao <bharata@amd.com> [2022-01-18 10:35:15]:

> The older format of /proc/pid/sched printed home node info which
> required the mempolicy and task lock around mpol_get(). However
> the format has changed since then and there is no need for
> sched_show_numa() any more to have mempolicy argument,
> asssociated mpol_get/put and task_lock/unlock. Remove them.
> 

> Fixes: 397f2378f1361 ("sched/numa: Fix numa balancing stats in /proc/pid/sched")
> Signed-off-by: Bharata B Rao <bharata@amd.com>

Agree. Since pol is now being used, this whole hunk can be removed.

Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

> ---
>  kernel/sched/debug.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index 7dcbaa31c5d9..50e05c8d0d61 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -931,25 +931,15 @@ void print_numa_stats(struct seq_file *m, int node, unsigned long tsf,
>  static void sched_show_numa(struct task_struct *p, struct seq_file *m)
>  {
>  #ifdef CONFIG_NUMA_BALANCING
> -	struct mempolicy *pol;
> -
>  	if (p->mm)
>  		P(mm->numa_scan_seq);
> 
> -	task_lock(p);
> -	pol = p->mempolicy;
> -	if (pol && !(pol->flags & MPOL_F_MORON))
> -		pol = NULL;
> -	mpol_get(pol);
> -	task_unlock(p);
> -
>  	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
>  }
> 
> -- 
> 2.25.1
> 

-- 
Thanks and Regards
Srikar Dronamraju

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa
  2022-01-18  5:05 [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa Bharata B Rao
  2022-01-18  6:58 ` Srikar Dronamraju
@ 2022-01-18 10:20 ` Mel Gorman
  2022-01-18 11:19 ` Peter Zijlstra
  2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Bharata B Rao
  3 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2022-01-18 10:20 UTC (permalink / raw)
  To: Bharata B Rao
  Cc: linux-kernel, mingo, peterz, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, bristot, srikar, riel

On Tue, Jan 18, 2022 at 10:35:15AM +0530, Bharata B Rao wrote:
> The older format of /proc/pid/sched printed home node info which
> required the mempolicy and task lock around mpol_get(). However
> the format has changed since then and there is no need for
> sched_show_numa() any more to have mempolicy argument,
> asssociated mpol_get/put and task_lock/unlock. Remove them.
> 
> Fixes: 397f2378f1361 ("sched/numa: Fix numa balancing stats in /proc/pid/sched")
> Signed-off-by: Bharata B Rao <bharata@amd.com>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa
  2022-01-18  5:05 [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa Bharata B Rao
  2022-01-18  6:58 ` Srikar Dronamraju
  2022-01-18 10:20 ` Mel Gorman
@ 2022-01-18 11:19 ` Peter Zijlstra
  2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Bharata B Rao
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2022-01-18 11:19 UTC (permalink / raw)
  To: Bharata B Rao
  Cc: linux-kernel, mingo, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, srikar,
	riel

On Tue, Jan 18, 2022 at 10:35:15AM +0530, Bharata B Rao wrote:
> The older format of /proc/pid/sched printed home node info which
> required the mempolicy and task lock around mpol_get(). However
> the format has changed since then and there is no need for
> sched_show_numa() any more to have mempolicy argument,
> asssociated mpol_get/put and task_lock/unlock. Remove them.
> 
> Fixes: 397f2378f1361 ("sched/numa: Fix numa balancing stats in /proc/pid/sched")
> Signed-off-by: Bharata B Rao <bharata@amd.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip: sched/core] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa
  2022-01-18  5:05 [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa Bharata B Rao
                   ` (2 preceding siblings ...)
  2022-01-18 11:19 ` Peter Zijlstra
@ 2022-01-28  7:40 ` tip-bot2 for Bharata B Rao
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Bharata B Rao @ 2022-01-28  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Bharata B Rao, Peter Zijlstra (Intel), Srikar Dronamraju,
	Mel Gorman, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     28c988c3ec29db74a1dda631b18785958d57df4f
Gitweb:        https://git.kernel.org/tip/28c988c3ec29db74a1dda631b18785958d57df4f
Author:        Bharata B Rao <bharata@amd.com>
AuthorDate:    Tue, 18 Jan 2022 10:35:15 +05:30
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 27 Jan 2022 12:57:18 +01:00

sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa

The older format of /proc/pid/sched printed home node info which
required the mempolicy and task lock around mpol_get(). However
the format has changed since then and there is no need for
sched_show_numa() any more to have mempolicy argument,
asssociated mpol_get/put and task_lock/unlock. Remove them.

Fixes: 397f2378f1361 ("sched/numa: Fix numa balancing stats in /proc/pid/sched")
Signed-off-by: Bharata B Rao <bharata@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lore.kernel.org/r/20220118050515.2973-1-bharata@amd.com
---
 kernel/sched/debug.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index aa29211..102d6f7 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -931,25 +931,15 @@ void print_numa_stats(struct seq_file *m, int node, unsigned long tsf,
 static void sched_show_numa(struct task_struct *p, struct seq_file *m)
 {
 #ifdef CONFIG_NUMA_BALANCING
-	struct mempolicy *pol;
-
 	if (p->mm)
 		P(mm->numa_scan_seq);
 
-	task_lock(p);
-	pol = p->mempolicy;
-	if (pol && !(pol->flags & MPOL_F_MORON))
-		pol = NULL;
-	mpol_get(pol);
-	task_unlock(p);
-
 	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
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-28  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-18  5:05 [PATCH] sched/debug: Remove mpol_get/put and task_lock/unlock from sched_show_numa Bharata B Rao
2022-01-18  6:58 ` Srikar Dronamraju
2022-01-18 10:20 ` Mel Gorman
2022-01-18 11:19 ` Peter Zijlstra
2022-01-28  7:40 ` [tip: sched/core] " tip-bot2 for Bharata B Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).