From: Ulrich Drepper <drepper@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Luca Barbieri <ldb@ldb.ods.org>
Subject: Re: [patch] threading fix, tid-2.5.47-A3
Date: Sun, 17 Nov 2002 11:03:55 -0800 [thread overview]
Message-ID: <3DD7E81B.5010706@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211170922020.4425-100000@home.transmeta.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Linus Torvalds wrote:
> This patch is crap, or at least needs a ton more explanation about why you
> would do something that looks quite this horrible and stupid.
Let me explani the use. Sorry for all the confusion. I left Ingo last
night in a state where he didn't have all the info.
The facts:
- - the settid syscall isn't used and is not needed anywhere in libc.so
- - it is only used in the init code of the new libpthread
I.e., all applications but those which are using the new thread code are
unaffected. No special exec handling. Set time, when the setid call is
executed, is early enough: it is the very first thing a multi-threaded
application does. It is the first constructor which is run. Always and
guaranteed.
The *alternatives* to this is a special whacky way to tell exec to do
this. I've no idea how this could be implemented at user level since
the registered address is at least in my code not known at link time.
So this is one of these rare situations where Linus and I actually agree
on something. The settid syscall is not used for exec but instead to
prevent modifying exec.
On to the second part: the clone() change is necessary for situations
where the CLONE_VM bit isn't set (to implement fork()). Using the
CLONE_SETTID flag nevertheless would mean a data structure in the parent
process would be affected. This isn't correct. The data structure
which has to be modified is still in use in the parent. That's the
whole point of fork(), the child inherits the same environment and might
on its own create more threads. I.e., the internals of the thread
library must be intact.
With the proposed change the TID is only written to the child's VM.
This is the right semantics since the child is the one which gets
notified in the end and which might get a signal delivered before it had
the chance to set the TID on its own. This one change saved us from the
mess this could potentially create plus it saves a system call.
And please note: how many normal application (not MT) are calling
getpid() first thing after fork()? With this patch it can be avoided.
Not a big win but it rectifies an IMO not too well designed since
asymmetric interface.
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE91+gb2ijCOnn/RHQRAluVAJ9nZB5/w3MImWbVKXS+nw05W+pfQACgzg/d
BsbD+2ff+BaRiDkbHhu1/9w=
=hnJQ
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2002-11-17 18:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-17 12:40 [patch] threading fix, tid-2.5.47-A3 Ingo Molnar
2002-11-17 11:57 ` Luca Barbieri
2002-11-17 13:36 ` Ingo Molnar
2002-11-17 13:49 ` Ingo Molnar
2002-11-17 13:29 ` Luca Barbieri
2002-11-17 17:28 ` Linus Torvalds
2002-11-17 19:03 ` Ulrich Drepper [this message]
2002-11-17 19:19 ` Ingo Molnar
2002-11-17 19:31 ` Ingo Molnar
2002-11-17 18:27 ` Linus Torvalds
2002-11-17 20:13 ` Ingo Molnar
2002-11-17 20:01 ` Jamie Lokier
[not found] <3DD7E3E7.6040403@redhat.com>
2002-11-17 18:54 ` Linus Torvalds
2002-11-17 20:18 ` Ingo Molnar
2002-11-17 20:37 ` Ingo Molnar
2002-11-17 19:54 ` Luca Barbieri
2002-11-17 21:17 ` Ingo Molnar
2002-11-17 20:16 ` Luca Barbieri
2002-11-17 21:45 ` Ingo Molnar
2002-11-17 20:35 ` Ulrich Drepper
2002-11-17 20:44 ` Jamie Lokier
2002-11-17 20:49 ` Luca Barbieri
2002-11-17 22:08 ` Ingo Molnar
2002-11-17 23:00 ` Linus Torvalds
2002-11-17 23:23 ` Ulrich Drepper
2002-11-18 1:33 ` Linus Torvalds
2002-11-18 3:33 ` Ulrich Drepper
2002-11-18 3:43 ` Linus Torvalds
2002-11-18 3:58 ` Ulrich Drepper
2002-11-18 4:11 ` Linus Torvalds
2002-11-18 4:31 ` Ulrich Drepper
2002-11-18 6:46 ` Ulrich Drepper
2002-11-18 16:00 ` Linus Torvalds
2002-11-18 8:07 ` Luca Barbieri
2002-11-18 8:21 ` Ulrich Drepper
2002-11-18 8:27 ` Luca Barbieri
2002-11-18 8:30 ` Luca Barbieri
2002-11-18 12:21 ` Ingo Molnar
2002-11-18 12:50 ` Luca Barbieri
2002-11-18 12:26 ` Ingo Molnar
2002-11-18 13:20 ` Alan Cox
2002-11-18 13:03 ` Luca Barbieri
2002-11-18 16:24 ` Linus Torvalds
2002-11-18 16:42 ` Ingo Molnar
2002-11-18 1:46 ` Jamie Lokier
2002-11-18 3:40 ` Ulrich Drepper
2002-11-18 22:22 ` Jamie Lokier
2002-11-17 23:37 ` Ulrich Drepper
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=3DD7E81B.5010706@redhat.com \
--to=drepper@redhat.com \
--cc=ldb@ldb.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@transmeta.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