1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-14 10:32:46 +00:00
Chen Yu db6cc3f4ac Revert "sched/numa: add statistics of numa balance task"
This reverts commit ad6b26b6a0a79166b53209df2ca1cf8636296382.

This commit introduces per-memcg/task NUMA balance statistics, but
unfortunately it introduced a NULL pointer exception due to the following
race condition: After a swap task candidate was chosen, its mm_struct
pointer was set to NULL due to task exit.  Later, when performing the
actual task swapping, the p->mm caused the problem.

CPU0                                   CPU1
:
...
task_numa_migrate
     task_numa_find_cpu
      task_numa_compare
        # a normal task p is chosen
        env->best_task = p

                                          # p exit:
                                          exit_signals(p);
                                             p->flags |= PF_EXITING
                                          exit_mm
                                             p->mm = NULL;

      migrate_swap_stop
        __migrate_swap_task((arg->src_task, arg->dst_cpu)
         count_memcg_event_mm(p->mm, NUMA_TASK_SWAP)# p->mm is NULL

task_lock() should be held and the PF_EXITING flag needs to be checked to
prevent this from happening.  After discussion, the conclusion was that
adding a lock is not worthwhile for some statistics calculations.  Revert
the change and rely on the tracepoint for this purpose.

Link: https://lkml.kernel.org/r/20250704135620.685752-1-yu.c.chen@intel.com
Link: https://lkml.kernel.org/r/20250708064917.BBD13C4CEED@smtp.kernel.org
Fixes: ad6b26b6a0a7 ("sched/numa: add statistics of numa balance task")
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Reported-by: Jirka Hladky <jhladky@redhat.com>
Closes: https://lore.kernel.org/all/CAE4VaGBLJxpd=NeRJXpSCuw=REhC5LWJpC29kDy-Zh2ZDyzQZA@mail.gmail.com/
Reported-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
Reported-by: Suneeth D <Suneeth.D@amd.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Hladky <jhladky@redhat.com>
Cc: Libo Chen <libo.chen@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-07-09 21:07:56 -07:00
..
2025-04-03 21:35:32 +02:00
2025-05-09 23:09:01 +02:00
2025-05-27 15:22:01 -07:00
2025-05-11 17:54:10 -07:00
2025-06-05 08:49:30 -07:00
2025-06-05 08:07:24 -07:00
2025-06-03 16:13:32 -07:00
2025-06-03 08:39:20 -07:00
2025-04-21 10:27:59 +02:00
2025-04-29 15:58:38 -04:00
2025-04-29 15:58:38 -04:00
2025-04-29 15:58:38 -04:00
2025-05-28 15:52:42 -07:00
2025-05-19 08:17:08 -07:00
2025-04-17 10:50:55 -07:00
2025-05-27 20:59:53 -07:00
2025-05-21 13:41:03 +02:00
2025-05-21 13:39:45 +02:00
2025-06-03 07:39:23 -07:00
2025-05-28 15:24:36 -07:00
2025-05-26 08:02:43 -07:00
2025-04-11 18:58:10 -07:00
2025-05-28 15:52:42 -07:00
2025-05-20 05:34:27 +02:00
2025-04-17 10:56:11 +02:00
2025-04-10 10:39:14 +01:00
2025-05-15 20:24:40 +02:00
2025-07-04 09:06:49 -07:00
\n
2025-05-29 10:34:26 -07:00
2025-05-30 08:40:25 -07:00
2025-06-03 08:39:20 -07:00
2025-05-22 11:07:05 +02:00
2025-04-01 18:03:46 -07:00
2025-06-17 14:29:19 +02:00
2025-05-30 10:44:20 -07:00
2025-05-27 08:00:46 -07:00
2025-06-11 11:57:14 -07:00
2025-05-11 17:48:29 -07:00
2025-05-26 08:02:43 -07:00
2025-05-28 15:24:36 -07:00
2025-04-02 17:06:31 -07:00
2025-06-04 09:51:10 +02:00
2025-06-02 15:31:05 -07:00
2025-05-22 20:30:34 +02:00
2025-06-04 11:26:17 -07:00
2025-05-21 16:46:37 +02:00
2025-04-26 08:28:03 +02:00
2025-05-02 11:03:18 +05:30
2025-06-04 11:26:17 -07:00
2025-05-03 12:02:04 +02:00
2025-05-11 17:54:09 -07:00
2025-05-06 11:11:45 -06:00
2025-04-25 15:53:59 +02:00
2025-04-07 09:36:49 +02:00
2025-04-10 18:34:05 -07:00
2025-06-03 07:39:23 -07:00
2025-05-15 04:49:15 +03:00
2025-06-19 12:36:19 +02:00
2025-04-18 10:05:49 -04:00
2025-05-28 14:55:35 -07:00
2025-05-27 20:49:06 -07:00