linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix put_task_struct() calls under PREEMPT_RT
@ 2023-01-20 15:02 Wander Lairson Costa
  2023-01-20 15:02 ` [PATCH v2 1/4] sched/task: Add the put_task_struct_atomic_safe function Wander Lairson Costa
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Wander Lairson Costa @ 2023-01-20 15:02 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider,
	Eric W. Biederman, Geert Uytterhoeven, Russell King (Oracle),
	Catalin Marinas, Wander Lairson Costa, Oleg Nesterov,
	Kefeng Wang, Andrew Morton, Thomas Gleixner,
	Sebastian Andrzej Siewior, Andy Lutomirski, Liam R. Howlett,
	Fenghua Yu, Andrei Vagin, open list

put_task_struct() decrements a usage counter and calls
__put_task_struct() if the counter reaches zero.

__put_task_struct() indirectly acquires a spinlock, which is a sleeping
lock under PREEMPT_RT. Therefore, we can't call put_task_struct() in an
atomic context in RT kernels.

This patch series introduces put_task_struct_atomic_safe(), which defers
the call to __put_task_struct() to a process context when compiled with
PREEMPT_RT.

It also fixes known problematic call sites.

Changelog:
==========

v2:
 * Add the put_task_struct_atomic_safe() function that is responsible for
   handling the conditions to call put_task_struct().
 * Replace put_task_struct() by put_task_struct_atomic_safe() in known
   atomic call sites.

Wander Lairson Costa (4):
  sched/task: Add the put_task_struct_atomic_safe function
  sched/deadline: fix inactive_task_timer splat
  sched/rt: use put_task_struct_atomic_safe() to avoid potential splat
  sched/core: use put_task_struct_atomic_safe() to avoid potential splat

 include/linux/sched/task.h | 21 +++++++++++++++++++++
 kernel/fork.c              |  8 ++++++++
 kernel/sched/core.c        |  2 +-
 kernel/sched/deadline.c    |  2 +-
 kernel/sched/rt.c          |  4 ++--
 5 files changed, 33 insertions(+), 4 deletions(-)

-- 
2.39.0


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

end of thread, other threads:[~2023-02-24 16:02 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 15:02 [PATCH v2 0/4] Fix put_task_struct() calls under PREEMPT_RT Wander Lairson Costa
2023-01-20 15:02 ` [PATCH v2 1/4] sched/task: Add the put_task_struct_atomic_safe function Wander Lairson Costa
2023-01-23 16:30   ` Oleg Nesterov
2023-01-23 16:49     ` Oleg Nesterov
2023-01-23 17:24     ` Wander Lairson Costa
2023-01-27 15:55       ` Valentin Schneider
2023-01-30 11:49         ` Wander Lairson Costa
2023-01-30 14:46           ` Valentin Schneider
2023-01-30 14:58             ` Wander Lairson Costa
2023-01-30 15:20               ` Valentin Schneider
2023-02-17 17:35           ` Daniel Bristot de Oliveira
2023-02-17 19:04             ` luca abeni
2023-02-22 18:42               ` Wander Lairson Costa
2023-02-22 21:00                 ` luca abeni
2023-02-24  8:46                   ` luca abeni
2023-02-24 13:02                     ` Wander Lairson Costa
2023-02-24 16:01                       ` luca abeni
2023-01-20 15:02 ` [PATCH v2 2/4] sched/deadline: fix inactive_task_timer splat Wander Lairson Costa
2023-01-20 15:02 ` [PATCH v2 3/4] sched/rt: use put_task_struct_atomic_safe() to avoid potential splat Wander Lairson Costa
2023-01-25  0:16   ` Steven Rostedt
2023-01-20 15:02 ` [PATCH v2 4/4] sched/core: " Wander Lairson Costa
2023-01-20 17:45 ` [PATCH v2 0/4] Fix put_task_struct() calls under PREEMPT_RT Valentin Schneider
2023-01-20 20:14   ` Wander Lairson Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).