Skip to content

Commit c34b61e

Browse files
committed
sched/numa: add tracepoint that tracks the skipping of numa balancing due to cpuset memory pinning
JIRA: https://issues.redhat.com/browse/RHEL-110301 commit 3fc567e Author: Libo Chen <[email protected]> Date: Wed Apr 23 19:45:23 2025 -0700 sched/numa: add tracepoint that tracks the skipping of numa balancing due to cpuset memory pinning Unlike sched_skip_vma_numa tracepoint which tracks skipped VMAs, this tracks the task subjected to cpuset.mems pinning and prints out its allowed memory node mask. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Libo Chen <[email protected]> Cc: "Chen, Tim C" <[email protected]> Cc: Chen Yu <[email protected]> Cc: Chris Hyser <[email protected]> Cc: Daniel Jordan <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Juri Lelli <[email protected]> Cc: K Prateek Nayak <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Madadi Vineeth Reddy <[email protected]> Cc: Mel Gorman <mgorman <[email protected]> Cc: Michal Koutný <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Raghavendra K T <[email protected]> Cc: Srikanth Aithal <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Venkat Rao Bagalkote <[email protected]> Cc: Vincent Guittot <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Phil Auld <[email protected]>
1 parent 304e6b6 commit c34b61e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

include/trace/events/sched.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,39 @@ TRACE_EVENT(sched_skip_vma_numa,
745745
__entry->vm_end,
746746
__print_symbolic(__entry->reason, NUMAB_SKIP_REASON))
747747
);
748+
749+
TRACE_EVENT(sched_skip_cpuset_numa,
750+
751+
TP_PROTO(struct task_struct *tsk, nodemask_t *mem_allowed_ptr),
752+
753+
TP_ARGS(tsk, mem_allowed_ptr),
754+
755+
TP_STRUCT__entry(
756+
__array( char, comm, TASK_COMM_LEN )
757+
__field( pid_t, pid )
758+
__field( pid_t, tgid )
759+
__field( pid_t, ngid )
760+
__array( unsigned long, mem_allowed, BITS_TO_LONGS(MAX_NUMNODES))
761+
),
762+
763+
TP_fast_assign(
764+
memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
765+
__entry->pid = task_pid_nr(tsk);
766+
__entry->tgid = task_tgid_nr(tsk);
767+
__entry->ngid = task_numa_group_id(tsk);
768+
BUILD_BUG_ON(sizeof(nodemask_t) != \
769+
BITS_TO_LONGS(MAX_NUMNODES) * sizeof(long));
770+
memcpy(__entry->mem_allowed, mem_allowed_ptr->bits,
771+
sizeof(__entry->mem_allowed));
772+
),
773+
774+
TP_printk("comm=%s pid=%d tgid=%d ngid=%d mem_nodes_allowed=%*pbl",
775+
__entry->comm,
776+
__entry->pid,
777+
__entry->tgid,
778+
__entry->ngid,
779+
MAX_NUMNODES, __entry->mem_allowed)
780+
);
748781
#endif /* CONFIG_NUMA_BALANCING */
749782

750783
/*

kernel/sched/fair.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,8 +3310,10 @@ static void task_numa_work(struct callback_head *work)
33103310
* Memory is pinned to only one NUMA node via cpuset.mems, naturally
33113311
* no page can be migrated.
33123312
*/
3313-
if (cpusets_enabled() && nodes_weight(cpuset_current_mems_allowed) == 1)
3313+
if (cpusets_enabled() && nodes_weight(cpuset_current_mems_allowed) == 1) {
3314+
trace_sched_skip_cpuset_numa(current, &cpuset_current_mems_allowed);
33143315
return;
3316+
}
33153317

33163318
if (!mm->numa_next_scan) {
33173319
mm->numa_next_scan = now +

0 commit comments

Comments
 (0)