Re: [PATCH] rmap 13a

Roman Zippel
2002-05-10T19:48:43Z

Hi,

William Lee Irwin III wrote:

> > Mapping everything into a single virtual area, so that the virtual address
> > can be used as a index in the memmap array, e.g.
> > #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT))
> > #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
>
> This appears to be calculating it from a physical address...

Why?

> > For the lookup function above this means it becomes:
> > TABLE(SHIFT_AND(addr, shift, mask)) + addr
> > so that every operation could be directly patched.
>
> This is the most interesting part, and appears very easy to genericize;
> I can produce this in short order unless you have a particular interest
> in doing it yourself (or have a patch waiting in the wings already).

It obfuscates the thing more than it helps. Only very few machines
really need it to this extreme.

> Maybe I should turn the question around instead, so I understand your
> motivation better:
> Why are you trying to hide physical addresses from the VM?

Because it doesn't need it. The VM works mostly with the page structure
and converts that as needed. It doesn't need to know how it's done.
Currently there are only few dependencies here, which gives us much
flexibility. I'm just afraid that by your generalization you create some
new rules how something has to be implemented. Sometimes that is needed,
but we should only do this if we gain a real advantage from it and I
don't see any.

bye, Roman