Re: (XFree86) mmap of /proc/XXX/mem

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Thu, 2 Dec 1999 12:55:25 +0100


Egbert Eich wrote:
> > In short: mmap on /proc/XXX/mem is bloody huge overkill. With
> > ill-specified semantics. If all you need is an alias on private data that
> > belongs to the same process - fine, but then it should be done in a
>
> Yes, but how?

1. Create a file, fill it up to size, mmap() it. You can mmap() parts
of a file to different addresses in the same process, and in that way
you get page aliasing. Only the pages you're thinking of aliasing
need to be mapped. Note that pages need to be flushed somehow on
some non-x86 architectures (the CPU cache is by virtual address), but
on x86 this is not required.

2. Create a shared memory block with shm*(). Use one for each page if
necessary.

3. Contribute kernel code for shared anonymous mappings.

-- Jamie

-
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/