Re: What I suspect

Richard Gooch (rgooch@ras.ucalgary.ca)
Wed, 8 Dec 1999 09:15:40 -0700


Linus Torvalds writes:
> The reason I'm suggesting a global page is _exactly_ to allow
> machine- and kernel-dependent operations that are invisible to
> process startup. That's why I suggested it in the first place, and
> that's why it's exactly the same old discussion about faster process
> startup.
>
> Because doing it dynamically in glibc just automatically requires
> that now ld.so or something has to check the machinedependent flags
> at each process startup. For things like GNU Emacs, that may not be
> a big deal ("oh, what's a few thousand extra cycles when the program
> takes 2 seconds to start up anyway"), but for other stuff it is
> lethal.

Rather than having the kernel provide a special page which it fills
with code (which in turn means more kernel bloat, as multiple
implementations will need to be kept in an __init section), why not
allow mmap(2) mappings to be inherited across execve(2)?

Add a new MAP_INHERIT flag to specify which mappings are to be
retained, and a new syscall to get the list of inherited mappings?

Then the init process could check the machine architecture and map in:
- architecture-specific shared object
- libc and other shared objects which are "always" loaded

the magic for this could be hidden inside libc or ld.so, so the
init(8) code doesn't have to be modified (thus it will work with any
implementation of init(8)).

The same (clean, IMHO) mechanism could be used so that Linus has his
architecture-specific "magic page(s)", and Ulrich can reduce startup
latency (because some symbol resolving is already done and because
each process doesn't have to call mmap(2) as much, which saves
building page tables). All with a minimum of kernel code.

If preloading is done, then you would fall back to the old scheme. I
don't think it's necessary to optimise this case. Preloading is a
temporary measure.

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/