Skip to contentSkip to conversation

Need for VM_INCOMPLETE on I/O mappings

DISCUSSION David S. Miller 1 participant 1 message Dec 10, 2005

lore
Share & tools
lore
#0 lore raw

Can you guys try out this patch from Hugh Dickins? It should fix the memory management problems, but I do not promise it will make the X server work fully :)

Thanks.

Quoted 4 lines · David S. Miller

The VM_INCOMPLETE scheme can't be used to handle my case, since that only works for pfn_valid() real pages of memory, not for I/O pages which have no backing page struct.

Thank you for describing this case, Dave. Thank goodness you found it now and not later. There may be other examples we haven't stumbled on yet. Linus was taking a risk with his vm_pgoff approach: we all thought it was a reasonable risk (just as earlier on we thought it a reasonable risk to reject MAP_PRIVATE,PROT_WRITE), but it hasn't paid off.

Quoted 3 lines

I'm kind of in a pickle about how to handle this. I guess we could "split" the VMA at the top level somehow, but that seems like a lot of work for something so seemingly simple.

Perhaps. Very ugly. Much more so than the existing use of incomplete_pfn_remap.

My answer is the same as it has been all along: 2.6.15-rc2-git6. That will have had no problem with your case.

I'll take a careful look at what's changed between then and now and try to come up with a patch combining the best of both. (But if that looks too much, fall back to your vma split idea.)

vm_insert_page is fine, VM_PFNMAP is fine. incomplete_pfn_remap and VM_INCOMPLETE and the vm_pgoff changes should go. I'll try to fit my page_is_anon inside Linus' vm_normal_page, I don't know if that will work out or not.

And once I've got something that really works, then see if I can somehow make it more palatable for Linus on his return. That's the hard part.

Quoted 3 lines

It's a shame that we've allowed so much cruft to accumulate in these driver mmap()s. I wish I had known years ago the implications of allowing discontiguous I/O mappings within a single VMA. :-/

No, what it was doing was permitted, and we should still permit it. Could deprecate it over several releases if we feel strongly that it's wrong (I don't), but we must not break it right now.

The good news, by the way, is that the ATI situation looks solved:
it was carefully "#if 0"ing a get_page on a PageReserved page in its wrapper, with warning comment on why: they just need to make that conditional on LINUX_VERSION, because that oddity is just what Nick got rid of.

Hugh