Re: mlockall and mmap of IO devices don't mix

Andrew Morton
2003-10-03T23:06:43Z

Joe Korty <joe.korty@ccur.com> wrote:
>
> > Something like this?
>
>
> Sigh. No go; it *looks* good but my app still locks up....

Oh crap, you're mapping /dev/mem rather than going through a device driver.
/dev/mem isn't setting VM_IO.

Does this little experiment make it go?

diff -puN drivers/char/mem.c~a drivers/char/mem.c
--- 25/drivers/char/mem.c~a Fri Oct 3 16:04:04 2003
+++ 25-akpm/drivers/char/mem.c Fri Oct 3 16:04:15 2003
@@ -176,7 +176,7 @@ static int mmap_mem(struct file * file,
/*
* Don't dump addresses that are not real memory to a core file.
*/
- if (uncached)
+// if (uncached)
vma->vm_flags |= VM_IO;

if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,

_

Course I could test it myself...

I wonder what to do. Perhaps /dev/mam should set VM_IO if any of the
mapped pages are not valid mem_map-style pageframes. Or maybe it should
just set VM_IO all the time.