Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2036814imm; Thu, 24 May 2018 04:55:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpce0gkuEx49mYPRtf2pux0aYyxkCjiGmZFAI4uTOtx6jvUfGTUO5z0j7oVQkDanxByVF7f X-Received: by 2002:a17:902:323:: with SMTP id 32-v6mr7272333pld.312.1527162951245; Thu, 24 May 2018 04:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162951; cv=none; d=google.com; s=arc-20160816; b=krT55K9nBamV5TYmus0KgEtYrKySrXhCI7RmyA91W/opMZd4xN4zItfQ3hOvcdyrt5 R2nXgHL8bmcXUTLLKDc/F/S9MpASseOtMwbk/TjOxC+29TXCNJX5XLCsLC+JJeRopHJ7 PCzJusO3CPnQTTrcHtvh2qTQhKQ7vLmQkBWpVOT2lXrzWiJTBDjTjSN9q112I5HF6PEL lt9jeyT/mlo+svnYuXXMs05IioSKD1YyjzA3Vp1VH4ZN1mH21d4rRSOX4cmq2TjUMl+q ZbEKHvf17EaVqLdlxQLCfBUN6t+73trVXSWyesfBNSn4ZX7/+fEB2DVMdcTwuqcE4v3D MMkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=/2976aUSLYb9y5lxnzmVFGf44r/utXaelQAbD9fLk+E=; b=H1tvJDkucHO1Yi8A20WxTJA2sNgghtZq9IGSdC++VFDPSRl86u5S8nz4CDafFt+6/k cyMPiog0jow4WTBE2RSXJeVbKio2Q4W3xlTQOdn+h/cDFPr/tB+EhNZ0MAvC5jrn9cQa SS/5RqC/hzKx+P3kKnD1nKhdd+WXgDgBhkHAZTTl6DaJEPdmyY9dFy/F6vwnR4C9+2Pm nE9AXLhcEqdxSjI/+Y61gexlK9AZ0hdpWH5iMtuVLFN89h1yysu5xsn81eH+9SOpzXN4 XZ0sRFFRpriPvh7bPbtTeAFTo8pDEIbdy9HT1FzLk6CZYmtYP4x8eXXyBPs+afbGvTyn uhIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fhv0wY1L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14-v6si16482558pgc.617.2018.05.24.04.55.36; Thu, 24 May 2018 04:55:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fhv0wY1L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966587AbeEXJqT (ORCPT + 99 others); Thu, 24 May 2018 05:46:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:57330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966467AbeEXJqK (ORCPT ); Thu, 24 May 2018 05:46:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D4BA20892; Thu, 24 May 2018 09:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155170; bh=BnvTPvHKertznefoPuvbIRV5GLMAi3BWtmRKUNk5Gms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhv0wY1LNIzLhSbENSBOk3yjzBpMAn+r4xd5dpwsPdYPLVoOVAyJ6ktLAYaSgeUu/ t7iu2MLqnJOLd4JiiUzU3OkJJoA5Usw5rn1CVOf91Ei5BAywFi907PrhxP7TrXZ/Lu IIKYNxnK3iT4lDEMPfzynRbCekccnvv6aEridCL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Davydov , Johannes Weiner , Michal Hocko , Vlastimil Babka , Mel Gorman , Andrew Morton , Linus Torvalds , Mel Gorman Subject: [PATCH 4.4 47/92] vmscan: do not force-scan file lru if its absolute size is small Date: Thu, 24 May 2018 11:38:24 +0200 Message-Id: <20180524093203.997483717@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vladimir Davydov commit 316bda0e6cc5f36f94b4af8bded16d642c90ad75 upstream. We assume there is enough inactive page cache if the size of inactive file lru is greater than the size of active file lru, in which case we force-scan file lru ignoring anonymous pages. While this logic works fine when there are plenty of page cache pages, it fails if the size of file lru is small (several MB): in this case (lru_size >> prio) will be 0 for normal scan priorities, as a result, if inactive file lru happens to be larger than active file lru, anonymous pages of a cgroup will never get evicted unless the system experiences severe memory pressure, even if there are gigabytes of unused anonymous memory there, which is unfair in respect to other cgroups, whose workloads might be page cache oriented. This patch attempts to fix this by elaborating the "enough inactive page cache" check: it makes it not only check that inactive lru size > active lru size, but also that we will scan something from the cgroup at the current scan priority. If these conditions do not hold, we proceed to SCAN_FRACT as usual. Signed-off-by: Vladimir Davydov Acked-by: Johannes Weiner Acked-by: Michal Hocko Cc: Vlastimil Babka Cc: Mel Gorman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Mel Gorman Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2057,10 +2057,16 @@ static void get_scan_count(struct lruvec } /* - * There is enough inactive page cache, do not reclaim - * anything from the anonymous working set right now. + * If there is enough inactive page cache, i.e. if the size of the + * inactive list is greater than that of the active list *and* the + * inactive list actually has some pages to scan on this priority, we + * do not reclaim anything from the anonymous working set right now. + * Without the second condition we could end up never scanning an + * lruvec even if it has plenty of old anonymous pages unless the + * system is under heavy pressure. */ - if (!inactive_file_is_low(lruvec)) { + if (!inactive_file_is_low(lruvec) && + get_lru_size(lruvec, LRU_INACTIVE_FILE) >> sc->priority) { scan_balance = SCAN_FILE; goto out; }