From: Konstantin Khlebnikov Date: Wed, 24 Aug 2011 23:47:12 +0000 (+1000) Subject: Logic added in commit 8cab4754d24a0 ("vmscan: make mapped executable pages X-Git-Tag: next-20110927~1^2~61 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=03c84c9e6419ab12456c0964e4418b33a6733513;p=karo-tx-linux.git Logic added in commit 8cab4754d24a0 ("vmscan: make mapped executable pages the first class citizen") was noticeably weakened in commit 645747462435d84 ("vmscan: detect mapped file pages used only once"). Currently these pages can become "first class citizens" only after second usage. After this patch page_check_references() will activate they after first usage, and executable code gets yet better chance to stay in memory. Signed-off-by: Konstantin Khlebnikov Cc: Pekka Enberg Cc: Minchan Kim Cc: KAMEZAWA Hiroyuki Cc: Wu Fengguang Cc: Johannes Weiner Cc: Nick Piggin Cc: Mel Gorman Cc: Shaohua Li Cc: Rik van Riel Signed-off-by: Andrew Morton --- diff --git a/mm/vmscan.c b/mm/vmscan.c index 017ae9674a0a..f8fd50144f7c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -717,6 +717,12 @@ static enum page_references page_check_references(struct page *page, if (referenced_page || referenced_ptes > 1) return PAGEREF_ACTIVATE; + /* + * Activate file-backed executable pages after first usage. + */ + if (vm_flags & VM_EXEC) + return PAGEREF_ACTIVATE; + return PAGEREF_KEEP; }