public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luca Barbieri <ldb@ldb.ods.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] threading fix, tid-2.5.47-A3
Date: 18 Nov 2002 13:50:03 +0100	[thread overview]
Message-ID: <1037623803.1774.138.camel@ldb> (raw)
In-Reply-To: <Pine.LNX.4.44.0211181318280.1639-100000@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]

> i'd just add MAP_DONTCOPY, and use a new non-MAP_DONTCOPY descriptor for
> the forked process. It's clearly possible with SETTID and SETTLS, nothing
> says that the new process must have the same TLS as the old one.
But it must have the same stack, and since you don't know which thread
is going to fork, the only way is to set MAP_DONTCOPY on everything and
then tell the kernel the ignore it at fork time.

An additional extension could be a MAP_THREAD flag that causes the vma
to be put in a linked list of vmas that are freed when the thread exits.

One would then use MAP_DONTCOPY | MAP_THREAD for the thread stacks
(maybe not setting MAP_THREAD unless there are a lot of thread, so that
an mmap doesn't have to be done for each pthread_create), only
MAP_DONTCOPY for the thread descriptors if they are
PTHREAD_CREATE_JOINABLE and MAP_DONTCOPY | MAP_THREAD if they are
PTHREAD_CREATE_DETACHED and then tell clone to copy the stack and
descriptor of the current process ignoring the MAP_DONTCOPY.

To do this, we need to add support for MAP_DONTCOPY and MAP_THREAD in
mmap and also in mprotect (by, for example, shifting the MAP_ flags 8
bit to the left and or'ing the PROT_ flags) and add a way to override
them at clone time.

For clone, it seems reasonable to implement this using an userspace
array pointed to by %ebp.
Array entries would contain a start address, an end address, a set of
flags to AND in mprotect format and a set of flags to XOR in mprotect
format (96 bits per entry if the mprotect flags fit in 16 bits).

The kernel mode implementation can do a normal copy of the vmas, then
scan the array and either remove, add or modify vmas to correct the copy
done before and finally setup pagetables based on the final vma tree.

All this can be further extended by adding support for memory allocation
and sharing memory rather than copy-on-writing it.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2002-11-18 12:43 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3DD7E3E7.6040403@redhat.com>
2002-11-17 18:54 ` [patch] threading fix, tid-2.5.47-A3 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  9:30                   ` [patch] threading enhancements, tid-2.5.47-C0 Ingo Molnar
2002-11-18  8:29                     ` Luca Barbieri
2002-11-18 12:12                       ` Ingo Molnar
2002-11-18 12:11                         ` Luca Barbieri
2002-11-20  1:40                         ` Ulrich Drepper
2002-11-20  1:59                           ` Linus Torvalds
2002-11-20  3:37                           ` Jamie Lokier
2002-11-20  4:04                             ` Ulrich Drepper
2002-11-20 21:55                               ` Jamie Lokier
2002-11-20 22:11                                 ` Ulrich Drepper
2002-11-20 23:26                                   ` Jamie Lokier
2002-11-20 23:28                                     ` Ulrich Drepper
2002-11-21  0:18                                       ` Jamie Lokier
2002-11-21  9:13                                         ` Ingo Molnar
2002-11-21 12:07                                           ` Jamie Lokier
2002-11-21  0:37                                   ` Jamie Lokier
2002-11-20  8:50                           ` Ingo Molnar
2002-11-20  9:51                             ` [patch] threading enhancements, tid-2.5.48-A1 Ingo Molnar
2002-11-20  8:41                               ` Ulrich Drepper
2002-11-20 20:20                               ` Luca Barbieri
2002-11-21 18:03                                 ` [patch] threading enhancements, tid-2.5.48-C0 Ingo Molnar
2002-11-21 19:30                                   ` Luca Barbieri
2002-11-18  8:30                 ` [patch] threading fix, tid-2.5.47-A3 Luca Barbieri
2002-11-18 12:21                   ` Ingo Molnar
2002-11-18 12:50                     ` Luca Barbieri [this message]
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
2002-11-17 12:40 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
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

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=1037623803.1774.138.camel@ldb \
    --to=ldb@ldb.ods.org \
    --cc=drepper@redhat.com \
    --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