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=-7.0 required=3.0 tests=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 25637C3F2D1 for ; Thu, 5 Mar 2020 15:17:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7EA02070E for ; Thu, 5 Mar 2020 15:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7EA02070E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72E946B0003; Thu, 5 Mar 2020 10:17:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B7566B0005; Thu, 5 Mar 2020 10:17:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57FB86B0007; Thu, 5 Mar 2020 10:17:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 3C4376B0003 for ; Thu, 5 Mar 2020 10:17:54 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 46EBC8248047 for ; Thu, 5 Mar 2020 15:17:54 +0000 (UTC) X-FDA: 76561663668.08.brick87_44f8dd5686b22 X-HE-Tag: brick87_44f8dd5686b22 X-Filterd-Recvd-Size: 4843 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Mar 2020 15:17:53 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id b3so6031442otp.4 for ; Thu, 05 Mar 2020 07:17:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q4QPATG/3/Sm4OaRvELHtHeMuQFLXjzsbek1YLX1a9g=; b=rWsdZ8EHs371rV2viMg79NUWZNbo3d54lUrsHe5eqkJQ4lel0LbM6icGfLL2RNPATb WmaRXYjYkDzdQ+cio7LwzdfFIbwm156Uqlrqk3tC8bU+uLcBYWxSYbUuaVUUcMM5+RKk HnTJtrVfkVhmqI4G8gPgG2F8UwRMCXOdiRr3vx3hlLYymbVh2SDcMxBGfdjfe3l8Kljo tQ6dizt5hPyvsV1UcVuXQh6au34RXyZV4Po76f9nhz4TFLKJLi6ky8NbpCwvCpQ6kHAk voPNWG0Z1VwAMRtKXAb9fLSSWbSVo4ll0eHClmwrIDxBCzTA5KWoCVxWdwv0XeSPHO/7 cJIA== X-Gm-Message-State: ANhLgQ0Lj47PwELHXgBblVQ5mdyWJ+wnaIUaEG2quGbo4hwjT9jvC6as L6URFdBxb1gujfGh/poAhdY= X-Google-Smtp-Source: ADFU+vs7wEjRizoxQGrERWKX06V8R9cj3X0vVN4OUINxCH5yEghr7UC9yz1ZjqGRRMMGfwmglbXaPQ== X-Received: by 2002:a9d:62cc:: with SMTP id z12mr7289202otk.119.1583421472641; Thu, 05 Mar 2020 07:17:52 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id r205sm10061073oih.54.2020.03.05.07.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 07:17:51 -0800 (PST) Date: Thu, 5 Mar 2020 16:17:43 +0100 From: Michal Hocko To: Adam Jackson Cc: linux-mm@kvack.org Subject: Re: [PATCH] mm/vmscan: Prioritize anonymous executable pages like we do file-backed Message-ID: <20200305151743.GB16139@dhcp22.suse.cz> References: <20200304203235.3623103-1-ajax@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304203235.3623103-1-ajax@redhat.com> 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: On Wed 04-03-20 15:32:35, 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. Are you seeing an actual improvement from this change? IIRC the primary motivation to make this heuristic page cache oriented is that it was quite easy to evict file backed memory by streaming IO. This shouldn't really be a major problem for the anonymous memory in most cases. A heavy swapin/out workload is likely to suffer from not having data available more than having the code evicted. But I might be wrong here and getting some numbers would be really interesting. > 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; > } > -- > 2.23.0 > -- Michal Hocko SUSE Labs