From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] de_thread: eliminate unneccessary sighand locking
Date: Sun, 19 Jun 2005 20:13:06 +0400 [thread overview]
Message-ID: <42B59992.3EFD4C73@tv-sign.ru> (raw)
while switching current->sighand de_thread does:
write_lock_irq(&tasklist_lock);
spin_lock(&oldsighand->siglock);
spin_lock(&newsighand->siglock);
current->sighand = newsighand;
recalc_sigpending();
Is these 2 sighand locks are really needed?
At this moment we already zapped other threads, so nobody
can access newsighand via current->. And we are holding
tasklist_lock, so other processes can't send signals to us
or use our ->sighand in any way.
oldsighand can be seen from CLONE_SIGHAND processes, but
we are not using oldsighand in any way, so this lock seems
to be unneeded too.
The only possibility that I can imagine is that some process
does:
read_lock(tasklist_lock);
task = find_task();
spin_lock(task->sighand->siglock);
read_unlock(tasklist_lock);
play with task->signal
Is this possible/allowed?
And why do we need recalc_sigpending() ? We are not changing
->pending or ->blocked, just ->sighand.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.12/fs/exec.c~ 2005-05-09 16:37:16.000000000 +0400
+++ 2.6.12/fs/exec.c 2005-06-20 00:03:24.000000000 +0400
@@ -758,14 +758,7 @@ no_thread_group:
sizeof(newsighand->action));
write_lock_irq(&tasklist_lock);
- spin_lock(&oldsighand->siglock);
- spin_lock(&newsighand->siglock);
-
current->sighand = newsighand;
- recalc_sigpending();
-
- spin_unlock(&newsighand->siglock);
- spin_unlock(&oldsighand->siglock);
write_unlock_irq(&tasklist_lock);
if (atomic_dec_and_test(&oldsighand->count))
next reply other threads:[~2005-06-19 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-19 16:13 Oleg Nesterov [this message]
2005-06-28 1:50 ` Roland McGrath
2005-06-28 6:17 ` Oleg Nesterov
2005-06-28 6:27 ` Roland McGrath
2005-06-28 6:42 ` Ingo Molnar
2005-06-28 7:08 ` Roland McGrath
2005-06-28 7:16 ` Ingo Molnar
2005-06-28 7:26 ` Roland McGrath
2005-06-28 8:26 ` Ingo Molnar
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=42B59992.3EFD4C73@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®