Re: aio-core why not using SuS? [Re: [rfc] aio-core for 2.5.29 (Re: async-io API registration for 2.5.29)]

Linus Torvalds
2002-08-17T16:55:51Z

On Fri, 16 Aug 2002, Martin J. Bligh wrote:
>
> I don't see why the area above PAGE_OFFSET has to be global, or per
> VM (by which I'm assuming you're meaning the set of pagetables per
> process, aka group of tasks sharing an mm).

Basic issue: if the VM's aren't _identical_ (in every way, including the
kernel one), they cannot share the page tables in an SMP environment with
two threads running on two CPU's at the same time.

And once you cannot share the page tables, you're screwed.

> Assume 3 level page tables and a 3/1 user/kernel split for the sake
> of argument.

No, no, that's the wrong way to go about it. You have to show a _portable_
way to do it, not a "if I assume this, I can do it".

For example, on x86 with the regular 2-level page tables, if you want to
have different kernel mappings, you have to copy the page directory
per-CPU, and then on task switch you have to change the PGD appropriately.

Which, btw, means that you have to invalidate the TLB for that CPU, even
if you would otherwise not have needed to. Look at how the lazy TLB
switching works, and realize that two threads can _switch_ CPU's as things
stand now, without ever a single TLB invalidate happening. They can take
over the TLB of the other thread when they move to another CPU. You'd
break that, horribly and fundamentally.

So to make this work, you'd have to have:
- architecture-specific hacks
- realize that not all architectures can do it at all, so the places that
depend on this would have to have some abstraction that makes it go
away when not needed.
- fix up lazy TLB switching (conditionally on the hack).

It just sounds really messy to me.

Linus