On Fri, Dec 20, 2013 at 4:53 AM, Benjamin LaHaise wrote: > > Yes, that's what I found when I started looking into this in detail again. > I think the page reference counting is actually correct. There are 2 > references on each page: the first is from the find_or_create_page() call, > and the second is from the get_user_pages() (which also makes sure the page > is populated into the page tables). Ok, I'm sorry, but that's just pure bullshit then. So it has the page array in the page cache, then mmap's it in, and uses get_user_pages() to get the pages back that it *just* created. This code is pure and utter garbage. It's beyond the pale how crazy it is. Why not just get rid of the idiotic get_user_pages() crap then? Something like the attached patch? Totally untested, but at least it makes *some* amount of sense. Linus