From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>,
Mateusz Guzik <mjguzik@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
"Liam R. Howlett" <Liam.Howlett@Oracle.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] release_task: kill the no longer needed get/put_pid(thread_pid)
Date: Fri, 11 Apr 2025 14:18:57 +0200 [thread overview]
Message-ID: <20250411121857.GA10550@redhat.com> (raw)
After the commit 7903f907a2260 ("pid: perform free_pid() calls outside
of tasklist_lock") __unhash_process() -> detach_pid() no longer calls
free_pid(), proc_flush_pid() can just use p->thread_pid without the
now pointless get_pid() + put_pid().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/exit.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 1b51dc099f1e..96d639383f86 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -239,7 +239,6 @@ void release_task(struct task_struct *p)
{
struct release_task_post post;
struct task_struct *leader;
- struct pid *thread_pid;
int zap_leader;
repeat:
memset(&post, 0, sizeof(post));
@@ -253,8 +252,6 @@ void release_task(struct task_struct *p)
pidfs_exit(p);
cgroup_release(p);
- thread_pid = get_pid(p->thread_pid);
-
write_lock_irq(&tasklist_lock);
ptrace_release_task(p);
__exit_signal(&post, p);
@@ -282,8 +279,8 @@ void release_task(struct task_struct *p)
}
write_unlock_irq(&tasklist_lock);
- proc_flush_pid(thread_pid);
- put_pid(thread_pid);
+ /* p->thread_pid can't go away until free_pids() below */
+ proc_flush_pid(p->thread_pid);
add_device_randomness(&p->se.sum_exec_runtime,
sizeof(p->se.sum_exec_runtime));
free_pids(post.pids);
--
2.25.1.362.g51ebf55
next reply other threads:[~2025-04-11 12:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 12:18 Oleg Nesterov [this message]
2025-04-11 12:33 ` [PATCH] release_task: kill the no longer needed get/put_pid(thread_pid) Mateusz Guzik
2025-04-14 11:42 ` Christian Brauner
2025-04-14 19:39 ` Christian Brauner
2025-04-14 19:45 ` Christian Brauner
2025-04-14 19:54 ` Mateusz Guzik
2025-04-14 20:45 ` Oleg Nesterov
2025-04-14 21:26 ` Mateusz Guzik
2025-04-15 7:35 ` Christian Brauner
2025-04-15 8:29 ` Mateusz Guzik
2025-04-14 20:39 ` Oleg Nesterov
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=20250411121857.GA10550@redhat.com \
--to=oleg@redhat.com \
--cc=Liam.Howlett@Oracle.com \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.