linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch]vmscan: protect exectuable page from inactive list scan
@ 2010-09-29  2:57 Shaohua Li
  2010-09-29 10:17 ` Johannes Weiner
  0 siblings, 1 reply; 11+ messages in thread
From: Shaohua Li @ 2010-09-29  2:57 UTC (permalink / raw)
  To: linux-mm; +Cc: hannes, riel, Andrew Morton, Wu, Fengguang

With commit 645747462435, pte referenced file page isn't activated in inactive
list scan. For VM_EXEC page, if it can't get a chance to active list, the
executable page protect loses its effect. We protect such page in inactive scan
here, now such page will be guaranteed cached in a full scan of active and
inactive list, which restores previous behavior.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c5dfabf..b973048 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -608,8 +608,15 @@ static enum page_references page_check_references(struct page *page,
 		 * quickly recovered.
 		 */
 		SetPageReferenced(page);
-
-		if (referenced_page)
+		/*
+		 * Identify pte referenced and file-backed pages and give them
+		 * one trip around the active list. So that executable code get
+		 * better chances to stay in memory under moderate memory
+		 * pressure. JVM can create lots of anon VM_EXEC pages, so we
+		 * ignore them here.
+		 */
+		if (referenced_page || ((vm_flags & VM_EXEC) &&
+		    page_is_file_cache(page)))
 			return PAGEREF_ACTIVATE;
 
 		return PAGEREF_KEEP;


--
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 related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-09-30  6:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-29  2:57 [patch]vmscan: protect exectuable page from inactive list scan Shaohua Li
2010-09-29 10:17 ` Johannes Weiner
2010-09-30  0:04   ` Shaohua Li
2010-09-30  2:27     ` KOSAKI Motohiro
2010-09-30  2:57       ` Wu Fengguang
2010-09-30  3:04         ` KOSAKI Motohiro
2010-09-30  3:20         ` Shaohua Li
2010-09-30  3:32           ` Wu Fengguang
2010-09-30  4:46           ` KOSAKI Motohiro
2010-09-30  5:46             ` Shaohua Li
2010-09-30  6:00               ` KOSAKI Motohiro

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).