public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] Task stuck on global_ctx_data_rwsem
@ 2025-12-22 23:34 Namhyung Kim
  2025-12-22 23:36 ` [BUG] perf/core: " Namhyung Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Namhyung Kim @ 2025-12-22 23:34 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
	linux-perf-users

Hello,

I got a report that a task is stuck in perf_event_exit_task() waiting
for global_ctx_data_rwsem.  On large systems, it'd have performance
issues when it grabs the lock to iterate all threads in the system to
allocate the context data.  And it'd block task exit path which is
problematic especially under memory pressure.

  perf_event_open
    perf_event_alloc
      attach_perf_ctx_data
        attach_global_ctx_data
          percpu_down_write (global_ctx_data_rwsem)
            for_each_process_thread
              alloc_task_ctx_data
                                               do_exit
                                                 perf_event_exit_task
                                                   percpu_down_read (global_ctx_data_rwsem)

I think attach_global_ctx_data() should skip tasks with PF_EXITING and
it'd be nice if perf_event_exit_task() could release the ctx_data
unconditionally.  But I'm not sure how to synchronize them properly.

Any thoughts?

Thanks,
Namhyung


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

end of thread, other threads:[~2026-01-08 19:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 23:34 [BUG] Task stuck on global_ctx_data_rwsem Namhyung Kim
2025-12-22 23:36 ` [BUG] perf/core: " Namhyung Kim
2026-01-06 22:34   ` Namhyung Kim
2026-01-07  9:16     ` Peter Zijlstra
2026-01-07 19:01       ` Namhyung Kim
2026-01-07 22:28         ` Peter Zijlstra
2026-01-07 22:32           ` Peter Zijlstra
2026-01-08 19:56             ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox