Skip to contentSkip to conversation

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

PATCH Applied Bharata B Rao 5 participants 5 messages Jan 18, 2022 – Jan 28, 2022 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 kernel/sched/debug.c | 10 ----------
 1 file changed, 10 deletions(-)
kernel/sched/debug.c +0 -10
index 7dcbaa31c5d9..50e05c8d0d61 100644
@@ -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
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · 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")

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

Quoted 37 lines
---
 kernel/sched/debug.c | 10 ----------
 1 file changed, 10 deletions(-)
kernel/sched/debug.c +0 -10
index 7dcbaa31c5d9..50e05c8d0d61 100644
@@ -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
 }
 
Signature · 1 line
2.25.1
Signature · 2 lines
Thanks and Regards
Srikar Dronamraju
reviewer Acked-by on v1 1/1
#2 lore raw
In reply to Bharata B Rao
Quoted 8 lines · 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")
Signature · 2 lines
Mel Gorman
SUSE Labs
maintainer
#3 lore raw
In reply to Bharata B Rao
Quoted 8 lines · 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")

Thanks!

merge bot Applied
#4 lore raw
In reply to Bharata B Rao
The following commit has been merged into the sched/core branch of tip:

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 <[email protected]>
AuthorDate:    Tue, 18 Jan 2022 10:35:15 +05:30
Committer:     Peter Zijlstra <[email protected]>
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")
---
 kernel/sched/debug.c | 10 ----------
 1 file changed, 10 deletions(-)
kernel/sched/debug.c +0 -10
index aa29211..102d6f7 100644
@@ -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
 }