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

Egbert Eich (eich@hilbert.ikp.physik.tu-darmstadt.de)
Thu, 2 Dec 1999 15:12:03 +0100 (MET)


Jamie Lokier writes:
> 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.

I tried something like that, too. However I didn't fill up the file -
I used lseek instead, this way I was only able to access the first
page. If I tried to access any higher pages it bus-errored. Maybe filling
it up does the trick - however then the process will get a private copy
of all pages in this 1Meg - even the ones that are not touched by the BIOS.
This will give me a 1Meg footprint for each real mode image.

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

OK, I'll look into this, too.

>
> 3. Contribute kernel code for shared anonymous mappings.
>
:-)) We want to get Xfree86 4.0 released some day. If I have
to work myself into this, too it will take even longer.

Thanks a lot for the hints!

Regards,
Egbert.

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