On Thu, Dec 19, 2013 at 10:29 AM, Benjamin LaHaise <bcrl@xxxxxxxxx> wrote: > >> I don't understand this page migration stuff at all, and I actually >> don't think I understand the refcounting w.r.t. the page cache either. >> But looking at (say) the aio_free_ring() call at line 409 - we just did >> one put_page() in aio_setup_ring(), and then _another_ put_page() in >> aio_free_ring()... ok, one of those corresponds to the get >> get_user_pages() did, but what's the other correspond to? > > The second put_page() should be dropping the page from the page cache. > Perhaps it would be better to rely on a truncate of the file to remove the > pages from the page cache. Yeah, that looks horribly buggy, if that's the intent. You can't just put_page() to remove something from the page cache. You need to do the whole "remove from radix tree" rigamarole, see for example delete_from_page_cache(). And you can't even do that blindly, because if the page is under writeback or otherwise busy, just removing it from the page cache and freeing it is wrong too. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>