lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 21 Oct 2011 14:21:48 +0200
From:	Joerg Roedel <joerg.roedel@....com>
To:	Andrea Arcangeli <aarcange@...hat.com>,
	Rik van Riel <riel@...hat.com>, <akpm@...ux-foundation.org>,
	Hugh Dickins <hugh.dickins@...cali.co.uk>,
	Mel Gorman <mel@....ul.ie>, Nick Piggin <npiggin@...nel.dk>
CC:	<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
	<joro@...tes.org>, Joerg Roedel <joerg.roedel@....com>
Subject: [PATCH 3/3] mmu_notifier: Call invalidate_range_free_pages() notifier

This patch adds the necessary calls to the new notifier.

Signed-off-by: Joerg Roedel <joerg.roedel@....com>
---
 mm/hugetlb.c |    1 +
 mm/memory.c  |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index dae27ba..d08998d 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2278,6 +2278,7 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
 	}
 	spin_unlock(&mm->page_table_lock);
 	flush_tlb_range(vma, start, end);
+	mmu_notifier_invalidate_range_free_pages(mm);
 	mmu_notifier_invalidate_range_end(mm, start, end);
 	list_for_each_entry_safe(page, tmp, &page_list, lru) {
 		page_remove_rmap(page);
diff --git a/mm/memory.c b/mm/memory.c
index b31f9e0..a5cc335 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1207,6 +1207,7 @@ again:
 	 * and page-free while holding it.
 	 */
 	if (force_flush) {
+		mmu_notifier_invalidate_range_free_pages(mm);
 		force_flush = 0;
 		tlb_flush_mmu(tlb);
 		if (addr != end)
@@ -1359,6 +1360,16 @@ unsigned long unmap_vmas(struct mmu_gather *tlb,
 		}
 	}
 
+	/*
+	 * In theory it would be sufficient to do the final flush for the last
+	 * bunch of pages queued by mmu_gather in mn_invalidate_range_end().
+	 * But that would break the API definition because in the _end notifier
+	 * the called subsystem has to assume that the pages are alread freed.
+	 * So call mn_invalidate_range_free_pages() explicitly here for the
+	 * final bunch of pages.
+	 */
+	mmu_notifier_invalidate_range_free_pages(mm);
+
 	mmu_notifier_invalidate_range_end(mm, start_addr, end_addr);
 	return start;	/* which is now the end (or restart) address */
 }
-- 
1.7.5.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ