Hi Guille,
Thanks for the taking the time.
On Mon, 24 Jul 2006, Guillermo Prandi wrote:
> 2) Kernel problem:
>
> You *think* you're not using read/write operations, but mmap consists
> precisely in read/write file system operations... **except** when you
> mmap /dev/mem **and** you use O_SYNC.
actually it doesn't. I've had some fun read kernel sources :-)
Each file device has a function table for various file related functions,
one such function is what to do for an mmap call on the file.
For /dev/mem, it uses the function mmap_mem() in drivers/char/mem.c If the
file flag has O_SYNC set mmap_mem() marks the physical memory for the
regional concerned as non-hardware-cachable. Without O_SYNC you still do a
real memory access, but you may be in danger of reading the last hardware
cache value.
> The fact you are using memory
> accesses doesn't mean that the file system below isn't working.
> Imagine what would happen if you use mmap to access any regular file
> like /etc/hosts or /etc/passwd.
It appears the mmap call for more regular files is often
generic_file_mmap() in mm/filemap.c which does the usual file system
buffering so that mmap will work with disk files as we usually expect.
I've now learnt stuff - so thanks to all conerned.
cheers
Jim
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|