linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Adam Jackson <ajax@redhat.com>
To: linux-mm@kvack.org
Subject: [PATCH] mm/vmscan: Prioritize anonymous executable pages like we do file-backed
Date: Wed,  4 Mar 2020 15:32:35 -0500	[thread overview]
Message-ID: <20200304203235.3623103-1-ajax@redhat.com> (raw)

The page reclamation scanner tries to keep executable pages resident,
since taking a hard page fault to satisfy an icache miss is really not
great for interactivity.  Anonymous executable pages tend to contain
code that has been just-in-time compiled for performance reasons. By
requiring that executable pages be file-backed, we're putting possibly
the most performance-sensitive code at higher risk of eviction, which
seems backwards.

On an amd64 machine running Fedora 31, the firefox I happen to have
running requires about 89M of file-backed text and 12M of anonymous text
for 30 open tabs. The next largest process in terms of anonymous text is
gnome-shell, with 1M anonymous and 57M file-backed. No other process had
significant anonymous text, most had none. Penalizing those 13M
specifically when under memory pressure seems like an easy hazard to
avoid.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 mm/vmscan.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index ee4eecc7e1c2..9bfbc30d61d8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2095,15 +2095,12 @@ static void shrink_active_list(unsigned long nr_to_scan,
 				    &vm_flags)) {
 			nr_rotated += hpage_nr_pages(page);
 			/*
-			 * Identify referenced, file-backed active pages and
-			 * give them one more trip around the active list. So
+			 * Identify referenced, executable active pages and
+			 * give them one more trip around the active list, so
 			 * that executable code get better chances to stay in
-			 * memory under moderate memory pressure.  Anon pages
-			 * are not likely to be evicted by use-once streaming
-			 * IO, plus JVM can create lots of anon VM_EXEC pages,
-			 * so we ignore them here.
+			 * memory under moderate memory pressure.
 			 */
-			if ((vm_flags & VM_EXEC) && page_is_file_cache(page)) {
+			if ((vm_flags & VM_EXEC)) {
 				list_add(&page->lru, &l_active);
 				continue;
 			}
-- 
2.23.0



             reply	other threads:[~2020-03-04 20:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 20:32 Adam Jackson [this message]
2020-03-04 20:38 ` Matthew Wilcox
2020-03-05 12:47 ` Vlastimil Babka
2020-03-05 20:41   ` Shakeel Butt
2020-03-05 22:58     ` Adam Jackson
2020-03-06  9:22       ` Mel Gorman
2020-03-05 15:17 ` Michal Hocko
2020-03-05 18:05   ` Adam Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200304203235.3623103-1-ajax@redhat.com \
    --to=ajax@redhat.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox