From: Frederic Weisbecker <frederic@kernel.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 1/4] task_work: s/task_work_cancel()/task_work_cancel_func()/
Date: Fri, 21 Jun 2024 11:15:58 +0200 [thread overview]
Message-ID: <20240621091601.18227-2-frederic@kernel.org> (raw)
In-Reply-To: <20240621091601.18227-1-frederic@kernel.org>
A proper task_work_cancel() API that actually cancels a callback and not
*any* callback pointing to a given function is going to be needed for
perf events event freeing. Do the appropriate rename to prepare for
that.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
include/linux/task_work.h | 2 +-
kernel/irq/manage.c | 2 +-
kernel/task_work.c | 10 +++++-----
security/keys/keyctl.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/task_work.h b/include/linux/task_work.h
index 795ef5a68429..23ab01ae185e 100644
--- a/include/linux/task_work.h
+++ b/include/linux/task_work.h
@@ -30,7 +30,7 @@ int task_work_add(struct task_struct *task, struct callback_head *twork,
struct callback_head *task_work_cancel_match(struct task_struct *task,
bool (*match)(struct callback_head *, void *data), void *data);
-struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
+struct callback_head *task_work_cancel_func(struct task_struct *, task_work_func_t);
void task_work_run(void);
static inline void exit_task_work(struct task_struct *task)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 71b0fc2d0aea..dd53298ef1a5 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1337,7 +1337,7 @@ static int irq_thread(void *data)
* synchronize_hardirq(). So neither IRQTF_RUNTHREAD nor the
* oneshot mask bit can be set.
*/
- task_work_cancel(current, irq_thread_dtor);
+ task_work_cancel_func(current, irq_thread_dtor);
return 0;
}
diff --git a/kernel/task_work.c b/kernel/task_work.c
index 95a7e1b7f1da..54ac24059daa 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -120,9 +120,9 @@ static bool task_work_func_match(struct callback_head *cb, void *data)
}
/**
- * task_work_cancel - cancel a pending work added by task_work_add()
- * @task: the task which should execute the work
- * @func: identifies the work to remove
+ * task_work_cancel_func - cancel a pending work matching a function added by task_work_add()
+ * @task: the task which should execute the func's work
+ * @func: identifies the func to match with a work to remove
*
* Find the last queued pending work with ->func == @func and remove
* it from queue.
@@ -131,7 +131,7 @@ static bool task_work_func_match(struct callback_head *cb, void *data)
* The found work or NULL if not found.
*/
struct callback_head *
-task_work_cancel(struct task_struct *task, task_work_func_t func)
+task_work_cancel_func(struct task_struct *task, task_work_func_t func)
{
return task_work_cancel_match(task, task_work_func_match, func);
}
@@ -168,7 +168,7 @@ void task_work_run(void)
if (!work)
break;
/*
- * Synchronize with task_work_cancel(). It can not remove
+ * Synchronize with task_work_cancel_match(). It can not remove
* the first entry == work, cmpxchg(task_works) must fail.
* But it can remove another entry from the ->next list.
*/
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 4bc3e9398ee3..ab927a142f51 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1694,7 +1694,7 @@ long keyctl_session_to_parent(void)
goto unlock;
/* cancel an already pending keyring replacement */
- oldwork = task_work_cancel(parent, key_change_session_keyring);
+ oldwork = task_work_cancel_func(parent, key_change_session_keyring);
/* the replacement session keyring is applied just prior to userspace
* restarting */
--
2.45.2
next prev parent reply other threads:[~2024-06-21 9:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 9:15 [PATCH 0/4 v4] perf: Fix leaked sigtrap events Frederic Weisbecker
2024-06-21 9:15 ` Frederic Weisbecker [this message]
2024-07-01 7:14 ` [tip: perf/urgent] task_work: s/task_work_cancel()/task_work_cancel_func()/ tip-bot2 for Frederic Weisbecker
2024-07-09 11:42 ` [tip: perf/core] " tip-bot2 for Frederic Weisbecker
2024-06-21 9:15 ` [PATCH 2/4] task_work: Introduce task_work_cancel() again Frederic Weisbecker
2024-07-01 7:14 ` [tip: perf/urgent] " tip-bot2 for Frederic Weisbecker
2024-07-09 11:42 ` [tip: perf/core] " tip-bot2 for Frederic Weisbecker
2024-06-21 9:16 ` [PATCH 3/4] perf: Fix event leak upon exit Frederic Weisbecker
2024-07-01 7:14 ` [tip: perf/urgent] " tip-bot2 for Frederic Weisbecker
2024-07-09 11:42 ` [tip: perf/core] " tip-bot2 for Frederic Weisbecker
2024-06-21 9:16 ` [PATCH 4/4] perf: Fix event leak upon exec and file release Frederic Weisbecker
2024-07-01 7:14 ` [tip: perf/urgent] " tip-bot2 for Frederic Weisbecker
2024-07-09 11:41 ` [tip: perf/core] " tip-bot2 for Frederic Weisbecker
2024-06-25 8:43 ` [PATCH 0/4 v4] perf: Fix leaked sigtrap events Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2024-05-16 14:09 [PATCH 0/4 v3] " Frederic Weisbecker
2024-05-16 14:09 ` [PATCH 1/4] task_work: s/task_work_cancel()/task_work_cancel_func()/ Frederic Weisbecker
2024-05-15 14:43 [PATCH 0/4 v2] perf: Fix leaked sigtrap events Frederic Weisbecker
2024-05-15 14:43 ` [PATCH 1/4] task_work: s/task_work_cancel()/task_work_cancel_func()/ Frederic Weisbecker
2024-03-29 23:58 [PATCH 0/4] perf: Fix leaked events when sigtrap = 1 Frederic Weisbecker
2024-03-29 23:58 ` [PATCH 1/4] task_work: s/task_work_cancel()/task_work_cancel_func()/ Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240621091601.18227-2-frederic@kernel.org \
--to=frederic@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox