On Tue, Mar 28, 2017 at 07:15:03PM -0700, Matthew Wilcox wrote: > > Is there a reason we call unmap_mapping_range() for a single page at a > time instead of the entire hugepage? This is surely more efficient ... > but does it do something like increase the refcount on the page? Yes, mapcount holds refcount on the page. So page_ref_freeze() will fail with proposed change. > I suppose we might be able to skip all the calls to unmap_mapping_range() > if none of the pages are mapped, but surely anonymous pages are usually > mapped? The valid optimization I *think* would be to call unmap_mapping_range() for whole huge page range before iterating over individual pages. This way we would only hit page_mapped() case if there was race with page fault. P.S. proper To/Cc would helped me to notice it. :) -- Kirill A. Shutemov -- 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>