| From: Chen Yu <yu.c.chen@intel.com> |
| Subject: sched-numa-add-statistics-of-numa-balance-task-migration-v3 |
| Date: Wed, 30 Apr 2025 18:36:23 +0800 |
| |
| Remove unnecessary p->mm check because kernel threads are not supported by |
| Numa Balancing. (Libo Chen) |
| |
| Link: https://lkml.kernel.org/r/20250430103623.3349842-1-yu.c.chen@intel.com |
| Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> |
| Tested-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com> |
| Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> |
| Signed-off-by: Chen Yu <yu.c.chen@intel.com> |
| Cc: Aubrey Li <aubrey.li@intel.com> |
| Cc: "Chen, Tim C" <tim.c.chen@intel.com> |
| Cc: Ingo Molnar <mingo@redhat.com> |
| Cc: Johannes Weiner <hannes@cmpxchg.org> |
| Cc: Jonathan Corbet <corbet@lwn.net> |
| Cc: Mel Gorman <mgorman <mgorman@suse.de> |
| Cc: Michal Hocko <mhocko@kernel.org> |
| Cc: Michal Koutný <mkoutny@suse.com> |
| Cc: Muchun Song <muchun.song@linux.dev> |
| Cc: Roman Gushchin <roman.gushchin@linux.dev> |
| Cc: Shakeel Butt <shakeel.butt@linux.dev> |
| Cc: Tejun Heo <tj@kernel.org> |
| Cc: Libo Chen <libo.chen@oracle.com> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| kernel/sched/core.c | 7 ++----- |
| 1 file changed, 2 insertions(+), 5 deletions(-) |
| |
| --- a/kernel/sched/core.c~sched-numa-add-statistics-of-numa-balance-task-migration-v3 |
| +++ a/kernel/sched/core.c |
| @@ -3353,9 +3353,7 @@ void set_task_cpu(struct task_struct *p, |
| static void __migrate_swap_task(struct task_struct *p, int cpu) |
| { |
| __schedstat_inc(p->stats.numa_task_swapped); |
| - |
| - if (p->mm) |
| - count_memcg_events_mm(p->mm, NUMA_TASK_SWAP, 1); |
| + count_memcg_events_mm(p->mm, NUMA_TASK_SWAP, 1); |
| |
| if (task_on_rq_queued(p)) { |
| struct rq *src_rq, *dst_rq; |
| @@ -7959,8 +7957,7 @@ int migrate_task_to(struct task_struct * |
| return -EINVAL; |
| |
| __schedstat_inc(p->stats.numa_task_migrated); |
| - if (p->mm) |
| - count_memcg_events_mm(p->mm, NUMA_TASK_MIGRATE, 1); |
| + count_memcg_events_mm(p->mm, NUMA_TASK_MIGRATE, 1); |
| trace_sched_move_numa(p, curr_cpu, target_cpu); |
| return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg); |
| } |
| _ |