[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230414125532.14958-1-wander@redhat.com>
Date: Fri, 14 Apr 2023 09:55:26 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Wander Lairson Costa <wander@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Guo Ren <guoren@...nel.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Oleg Nesterov <oleg@...hat.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Christian Brauner <brauner@...nel.org>,
Andrei Vagin <avagin@...il.com>,
Shakeel Butt <shakeelb@...gle.com>,
linux-kernel@...r.kernel.org (open list),
linux-perf-users@...r.kernel.org (open list:PERFORMANCE EVENTS
SUBSYSTEM)
Subject: [PATCH v6 0/3] Introduce put_task_struct_atomic_sleep()
The put_task_struct() function reduces a usage counter and invokes
__put_task_struct() when the counter reaches zero.
In the case of __put_task_struct(), it indirectly acquires a spinlock,
which operates as a sleeping lock under the PREEMPT_RT configuration.
As a result, invoking put_task_struct() within an atomic context is
not feasible for real-time (RT) kernels.
To address this issue, this patch series introduces a new function
called put_task_struct_atomic_safe(). When compiled with the
PREEMPT_RT configuration, this function defers the call to
__put_task_struct() to a process context.
Additionally, the patch series rectifies known problematic call sites
to ensure smooth functioning.
Changelog
=========
v1:
* Initial implementation fixing the splat.
v2:
* Isolate the logic in its own function.
* Fix two more cases caught in review.
v3:
* Change __put_task_struct() to handle the issue internally.
v4:
* Explain why call_rcu() is safe to call from interrupt context.
v5:
* Explain why __put_task_struct() doesn't conflict with
put_task_sruct_rcu_user.
v6:
* As per Sebastian's review, revert back the implementation of v2
with a distinct function.
* Add a check in put_task_struct() to warning when called from a
non-sleepable context.
* Address more call sites.
Wander Lairson Costa (3):
sched/core: warn on call put_task_struct in invalid context
sched/task: Add the put_task_struct_atomic_safe() function
treewide: replace put_task_struct() witht the atomic safe version
include/linux/sched/task.h | 45 ++++++++++++++++++++++++++++++++++++++
kernel/events/core.c | 6 ++---
kernel/fork.c | 8 +++++++
kernel/locking/rtmutex.c | 10 ++++-----
kernel/sched/core.c | 6 ++---
kernel/sched/deadline.c | 16 +++++++-------
kernel/sched/rt.c | 4 ++--
7 files changed, 74 insertions(+), 21 deletions(-)
--
2.39.2
Powered by blists - more mailing lists