[PATCH] [22/31] CPA: Only queue actually unused page table pages for freeing

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <jbeulich@...>, <mingo@...>, <tglx@...>
Date: Monday, January 14, 2008 - 6:16 pm

With the separate data structure added for flush earlier it is only
needed to call save_page() now on pte pages that have been already reverted.

Also move all freeing checks into the caller.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/mm/pageattr_32.c |    4 +---
 arch/x86/mm/pageattr_64.c |    7 +++----
 2 files changed, 4 insertions(+), 7 deletions(-)

Index: linux/arch/x86/mm/pageattr_32.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_32.c
+++ linux/arch/x86/mm/pageattr_32.c
@@ -270,9 +270,9 @@ __change_page_attr(struct page *page, pg
 	 * replace it with a largepage.
 	 */
 
-	save_page(kpte_page);
 	if (!PageReserved(kpte_page)) {
 		if (cpu_has_pse && (page_private(kpte_page) == 0)) {
+			save_page(kpte_page);
 			paravirt_release_pt(page_to_pfn(kpte_page));
 			revert_page(kpte_page, address);
 		}
@@ -333,8 +333,6 @@ void global_flush_tlb(void)
 	list_for_each_entry_safe(pg, next, &free_pages, lru) {
 		list_del(&pg->lru);
 		ClearPageDeferred(pg);
-		if (PageReserved(pg) || !cpu_has_pse || page_private(pg) != 0)
-			continue;
 		ClearPagePrivate(pg);
 		__free_page(pg);
 	}
Index: linux/arch/x86/mm/pageattr_64.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_64.c
+++ linux/arch/x86/mm/pageattr_64.c
@@ -246,9 +246,10 @@ __change_page_attr(unsigned long address
 	/* on x86-64 the direct mapping set at boot is not using 4k pages */
 	BUG_ON(PageReserved(kpte_page));
 
-	save_page(kpte_page);
-	if (page_private(kpte_page) == 0)
+	if (page_private(kpte_page) == 0) {
+		save_page(kpte_page);
 		revert_page(address, ref_prot);
+	}
 	return 0;
 } 
 
@@ -336,8 +337,6 @@ void global_flush_tlb(void)
 	list_for_each_entry_safe(pg, next, &free_pages, lru) {
 		list_del(&pg->lru);
 		ClearPageDeferred(pg);
-		if (page_private(pg) != 0)
-			continue;
 		ClearPagePrivate(pg);
 		__free_page(pg);
 	} 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [31/31] Clean up pte_exec, Andi Kleen, (Mon Jan 14, 6:17 pm)
[PATCH] [30/31] Remove set_kernel_exec, Andi Kleen, (Mon Jan 14, 6:17 pm)
[PATCH] [22/31] CPA: Only queue actually unused page table p..., Andi Kleen, (Mon Jan 14, 6:16 pm)
[PATCH] [9/31] CPA: Add simple self test at boot, Andi Kleen, (Mon Jan 14, 6:16 pm)
Re: [PATCH] [9/31] CPA: Add simple self test at boot, Harvey Harrison, (Tue Jan 15, 6:37 am)
[PATCH] [6/31] CPA: Undo white space changes, Andi Kleen, (Mon Jan 14, 6:16 pm)
[PATCH] [4/31] Add pte_pgprot on i386, Andi Kleen, (Mon Jan 14, 6:16 pm)
Re: [PATCH] [4/31] Add pte_pgprot on i386, Johannes Weiner, (Tue Jan 15, 9:00 am)
[PATCH] [3/31] Add pte accessors for the global bit, Andi Kleen, (Mon Jan 14, 6:16 pm)
[PATCH] [2/31] CPA: Do a simple self test at boot, Andi Kleen, (Mon Jan 14, 6:16 pm)
Re: [PATCH] [2/31] CPA: Do a simple self test at boot, Harvey Harrison, (Tue Jan 15, 4:47 am)
Re: [PATCH] [2/31] CPA: Do a simple self test at boot, Harvey Harrison, (Tue Jan 15, 6:07 am)