From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90137C3F2D1 for ; Wed, 4 Mar 2020 20:32:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 33E712146E for ; Wed, 4 Mar 2020 20:32:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JYDfCrZq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33E712146E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 990F06B0003; Wed, 4 Mar 2020 15:32:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91A4A6B0005; Wed, 4 Mar 2020 15:32:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 808996B0007; Wed, 4 Mar 2020 15:32:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 65B9E6B0003 for ; Wed, 4 Mar 2020 15:32:39 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 03F1B4417 for ; Wed, 4 Mar 2020 20:32:39 +0000 (UTC) X-FDA: 76558828038.26.scene18_8b868549c2e27 X-HE-Tag: scene18_8b868549c2e27 X-Filterd-Recvd-Size: 4127 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Mar 2020 20:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583353958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5H+yeYBGEEeRP85T77PxYABsK3Vc7iKLOEM+HoeL4eQ=; b=JYDfCrZq3+14WlXU6fp0bFkAA4NCBRdEqGGr5j6iH+GdaqS5yhyz4ZOa82BLT/JN5tEf4/ VUUxEgHktYvMyTlIUIWjMymqXWwuGN7F7aH7AVZ4v26TiECTzcHPAKunkOz4JqaD6QtFZK hIy6huEIpi8qI9D00AabJgcS8UbZXYs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-266-uK5PSoSrNIWHS4PfkmTbqw-1; Wed, 04 Mar 2020 15:32:36 -0500 X-MC-Unique: uK5PSoSrNIWHS4PfkmTbqw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C44B6107ACCA for ; Wed, 4 Mar 2020 20:32:35 +0000 (UTC) Received: from datura.bss.redhat.com (dhcp-10-20-1-78.bss.redhat.com [10.20.1.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87D4660C80 for ; Wed, 4 Mar 2020 20:32:35 +0000 (UTC) From: Adam Jackson 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 Message-Id: <20200304203235.3623103-1-ajax@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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, =09=09=09=09 &vm_flags)) { =09=09=09nr_rotated +=3D hpage_nr_pages(page); =09=09=09/* -=09=09=09 * Identify referenced, file-backed active pages and -=09=09=09 * give them one more trip around the active list. So +=09=09=09 * Identify referenced, executable active pages and +=09=09=09 * give them one more trip around the active list, so =09=09=09 * that executable code get better chances to stay in -=09=09=09 * memory under moderate memory pressure. Anon pages -=09=09=09 * are not likely to be evicted by use-once streaming -=09=09=09 * IO, plus JVM can create lots of anon VM_EXEC pages, -=09=09=09 * so we ignore them here. +=09=09=09 * memory under moderate memory pressure. =09=09=09 */ -=09=09=09if ((vm_flags & VM_EXEC) && page_is_file_cache(page)) { +=09=09=09if ((vm_flags & VM_EXEC)) { =09=09=09=09list_add(&page->lru, &l_active); =09=09=09=09continue; =09=09=09} --=20 2.23.0