/* We don't save and restore VM_LOCKED here because pages are still on lru. In unmap path, pages might be scanned by reclaim and re-mlocked by try_to_{munlock|unmap} before we unmap and free them. This will result in freeing mlocked pages.  */
void munlock_vma_pages_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
/* We don't save and restore VM_LOCKED here because pages are still on lru. In unmap path, pages might be scanned by reclaim and re-mlocked by try_to_{munlock|unmap} before we unmap and free them. This will result in freeing mlocked pages.  */
void munlock_vma_pages_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
	unsigned long addr;
	lru_add_drain();
	vma->vm_flags &= ~VM_LOCKED;
	for (addr = start; addr < end; addr += PAGE_SIZE) {
		struct page *page;
		page = follow_page(vma, addr, FOLL_GET | FOLL_DUMP);
		if (page && !IS_ERR(page)) {
			lock_page(page);
			if (page->mapping)
				munlock_vma_page(page);
			unlock_page(page);
			put_page(page);
		}
		cond_resched();
	}
}