Skip to content

Fix put_task_struct() calls under PREEMPT_RT

Wander Lairson Costa lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 18 repliesIn review

Changes in v2 from the cover letter

* 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.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sched/task: Add the put_task_struct_atomic_safe functioninclude/linux/sched/task.h kernel/fork.c+29 -015 replies
2/4sched/deadline: fix inactive_task_timer splatkernel/sched/deadline.c+1 -10 replies
3/4sched/rt: use put_task_struct_atomic_safe() to avoid potential splatkernel/sched/rt.c+2 -21 reply
4/4sched/core: use put_task_struct_atomic_safe() to avoid potential splatkernel/sched/core.c+1 -10 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchSteven Rostedt (Google)
1/4
2/4
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] Fix put_task_struct() calls under PREEMPT_RT

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(-)
Signature · 1 line
2.39.0