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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 BB52AC3F2CD for ; Thu, 5 Mar 2020 12:48:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 81F8D20848 for ; Thu, 5 Mar 2020 12:48:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81F8D20848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1D51D6B0003; Thu, 5 Mar 2020 07:48:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 185936B0005; Thu, 5 Mar 2020 07:48:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09C146B0007; Thu, 5 Mar 2020 07:48:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id E6A726B0003 for ; Thu, 5 Mar 2020 07:48:00 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DDCEB8248047 for ; Thu, 5 Mar 2020 12:48:00 +0000 (UTC) X-FDA: 76561285920.28.hate68_45f03577fd926 X-HE-Tag: hate68_45f03577fd926 X-Filterd-Recvd-Size: 3391 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Mar 2020 12:48:00 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 17ED7B07B; Thu, 5 Mar 2020 12:47:58 +0000 (UTC) Subject: Re: [PATCH] mm/vmscan: Prioritize anonymous executable pages like we do file-backed To: Adam Jackson , linux-mm@kvack.org References: <20200304203235.3623103-1-ajax@redhat.com> Cc: Johannes Weiner , Shakeel Butt , Roman Gushchin , Joonsoo Kim , Michal Hocko , Mel Gorman From: Vlastimil Babka Message-ID: <8b8420f9-12bc-b247-7727-f82038ffa6e7@suse.cz> Date: Thu, 5 Mar 2020 13:47:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200304203235.3623103-1-ajax@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: + CC folks who focus on reclaim On 3/4/20 9:32 PM, Adam Jackson wrote: > 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, > &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; > } >