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

Joe Korty
2003-10-03T23:29:15Z

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

You're right; I just tried your original patch with a real device driver
and it worked.

> Does this little experiment make it go?
> - if (uncached)
> +// if (uncached)

Yes it does....

(am about to look at and try your third patch out).

Comments of the first patch:

vm_io = vma->vm_flags & VM_IO;

uses 'vma' before it has been established that vma is a
non-NULL pointer. Perhaps we should go back to just using
(vma_flags &VM_IO) everywhere it is needed?

Also, conside changing

while (!vm_io && !(map = follow_page(mm,start,write))) {
to
if (!vm_io) {
while (!(map = ...))) {
....
}
if (pages) {
....
}
}

as it more clearly codes up the intended effect, rather than relying
on side effects ('pages' happens to be NULL whenever VM_IO is set).

Joe