Re: [openib-general] Re: [PATCH][RFC][0/4] InfiniBand userspace verbs implementation

Timur Tabi
2005-05-06T23:12:01Z

Timur Tabi wrote:

> I haven't gotten a reply to this question, but I've done my own
> research, and I think I found the answer. Using my own test of
> get_user_pages(), it appears that the fix was placed in 2.6.7. However,
> I would like to know specifically what the fix is. Unfortunately,
> tracking this stuff down is beyond my understanding of the Linux VM.

I'm also still waiting for a reply to this question. Anyone????

Upon doing some more research, I think the fix might be those code instead:

/*
* Don't pull an anonymous page out from under get_user_pages.
* GUP carefully breaks COW and raises page count (while holding
* page_table_lock, as we have here) to make sure that the page
* cannot be freed. If we unmap that page here, a user write
* access to the virtual address will bring back the page, but
* its raised count will (ironically) be taken to mean it's not
* an exclusive swap page, do_wp_page will replace it by a copy
* page, and the user never get to see the data GUP was holding
* the original page for.
*/
if (PageSwapCache(page) &&
page_count(page) != page->mapcount + 2) {
ret = SWAP_FAIL;
goto out_unmap;
}

Both this change and the other one I mentioned are new to 2.6.7. I suppose I could try
applying these patches to the 2.6.6 kernel and see if anything improves, but that won't
help me understand what's really going on. The above comment makes sounds almost like
it's a fix, but it talks about copy-on-write, which is has nothing to do with the real
problem.

--
Timur Tabi
Staff Software Engineer
timur.tabi@ammasso.com

One thing a Southern boy will never say is,
"I don't think duct tape will fix it."
-- Ed Smylie, NASA engineer for Apollo 13