linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC]x86: clearing access bit don't flush tlb
@ 2013-01-07  8:12 Shaohua Li
  2013-01-07 15:14 ` Rik van Riel
  2013-01-08  3:14 ` Simon Jeons
  0 siblings, 2 replies; 10+ messages in thread
From: Shaohua Li @ 2013-01-07  8:12 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm, mingo, hpa, riel


We use access bit to age a page at page reclaim. When clearing pte access bit,
we could skip tlb flush for the virtual address. The side effect is if the pte
is in tlb and pte access bit is unset, when cpu access the page again, cpu will
not set pte's access bit. So next time page reclaim can reclaim hot pages
wrongly, but this doesn't corrupt anything. And according to intel manual, tlb
has less than 1k entries, which coverers < 4M memory. In today's system,
several giga byte memory is normal. After page reclaim clears pte access bit
and before cpu access the page again, it's quite unlikely this page's pte is
still in TLB. Skiping the tlb flush for this case sounds ok to me.

And in some workloads, TLB flush overhead is very heavy. In my simple
multithread app with a lot of swap to several pcie SSD, removing the tlb flush
gives about 20% ~ 30% swapout speedup.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
 arch/x86/mm/pgtable.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: linux/arch/x86/mm/pgtable.c
===================================================================
--- linux.orig/arch/x86/mm/pgtable.c	2012-12-17 16:54:37.847770807 +0800
+++ linux/arch/x86/mm/pgtable.c	2013-01-07 14:59:40.898066357 +0800
@@ -376,13 +376,8 @@ int pmdp_test_and_clear_young(struct vm_
 int ptep_clear_flush_young(struct vm_area_struct *vma,
 			   unsigned long address, pte_t *ptep)
 {
-	int young;
 
-	young = ptep_test_and_clear_young(vma, address, ptep);
-	if (young)
-		flush_tlb_page(vma, address);
-
-	return young;
+	return ptep_test_and_clear_young(vma, address, ptep);
 }
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-01-15  1:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07  8:12 [RFC]x86: clearing access bit don't flush tlb Shaohua Li
2013-01-07 15:14 ` Rik van Riel
2013-01-07 22:31   ` H. Peter Anvin
2013-01-08  4:55     ` Shaohua Li
2013-01-08  5:03       ` H. Peter Anvin
2013-01-08  5:08         ` Rik van Riel
2013-01-08  5:09           ` H. Peter Anvin
2013-01-08  7:03             ` Rik van Riel
2013-01-15  1:41               ` Shaohua Li
2013-01-08  3:14 ` Simon Jeons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).