Re: mmap() versus read()

Linus Torvalds (torvalds@transmeta.com)
Tue, 10 Mar 1998 16:51:16 -0800 (PST)


On Tue, 10 Mar 1998, Perry Harrington wrote:
>
> Yes, that seems right. Question to the gurus:
>
> Is it possible to make a process run as a "sandbox" to child TSSes? Meaning,
> could you create a process in which it ran in a ring that was identical to
> the children TSSes? This way you could appropriate the "expensive" stuff to
> a process (IO mask maintenance and other system stuff) and make lightweight
> subprocesses.

Nope, not really. The TSS contains the IO permission bitmap which arguably
should be shared between threads, but it also contains a lot of data that
obviously can _not_ be shared (kernel stack pointer value and register
save area).

My approach has been to make the IO permission bitmap be a very per-thread
thing, and just say that if threads want to use direct IO accesses
(something that should be considered fairly suspect anyway) then they need
to make sure that all threads have the proper access rights.

> Also, did anyone catch that remark about the non-inherited IO perms for clone()d
> threads?

This is something that could easily be changed, but I have yet seen a
really strong argument for it (and there are arguments for not inheriting
IO permissions - tryint to limit the permissions is a good thing).

> Also, are there any plans in the near future to implement MMX extensions
> in the Linux kernel for bulk copies and such?

Probably in the not too distant future, but it hasn't been a major
concern. The string instructions do much of the bulk copying better on
many chips (PPro and Pentium II) and are fundamentally easier to use. The
pentium fpu-copy patches should work with very few modifications to use
MMX instead of floating point, but there really isn't much difference by
the time you're doing that anyway (and floating point register usage is
more widespread: it works even on older Pentium chips).

The only compelling reason to use MMX is actually that you could in theory
do copy-and-ipv4-csum with them. Peter Anvin had some code that would
probably work, but it was complex enough that it was not clear whether it
would really be a win..

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu