Memory mapped IO and Direct File IO

Stefan Bohne Stefan.Bohne at senTec-Elektronik.de
Tue Aug 4 16:06:03 EST 2009


Greetings, everyone,

I'm trying to save some data block from a memory mapped device into a
file - real fast, i.e., without any copying.

My approach so far was to get a pointer to the io memory via mmap-ing
/dev/mem, and then writing this pointer to a file (in user space).
This works, if I don't use O_DIRECT, but this is slow of course. Using
O_DIRECT, write returns EFAULT (bad address). Coyping the data to a
user-space buffer and then writing with O_DIRECT works, though.

I tracked this down to __get_user_pages in mm/memory.c where IO pages
are refused. And this is as deep as my current knowledge allows me to
go into the kernel. I don't understand why IO pointers are not
allowed.

Ultra-Fast disk IO is a requirement for our project, so any copying in
between is not an option. Any hint is appreciated.

Stefan


More information about the Linuxppc-dev mailing list