Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2577734pxb; Mon, 11 Jan 2021 13:28:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEQIgLTJC+G2eDh/9GsANmmAnONUhMxYpW0mV26lYnyXnh3x74uCFyUzJNzhmblWg3P3Xs X-Received: by 2002:aa7:d915:: with SMTP id a21mr907514edr.251.1610400485187; Mon, 11 Jan 2021 13:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610400485; cv=none; d=google.com; s=arc-20160816; b=Ittf8vOfKprd3wgaRe+79t/lc6OWzR9IHHK3XuOaIfxNQHzhNMq/7Vakre1FOREfxG MfwuHlQfvOVJha8xPKMyUECiDvJCfQpb/tWxxEIPm8++igEq0LLKUC4JyblMvR3qQ80e m34WnsyB9K1HJKmyYQJKSzVNbPaOdHht8NgnviKRHZ+oZtzQ1aeWT45BEB0pJ50fOLOm qCBLgnIUYf0tO/bub4+edaaff0SBqncnvkhdXIu6mk4roblEkoUTwimaUalByxhUlgtJ HZJzNUuciaX4Rdt/mcvjQxXKkE4MJuphWYqYPZa+G6CQSpCfdtpx+CJ67JyB1uPFHcYl OhOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+AfvfCqsfaWkYAg6+USDuxUF1iByJwAHFmuzpuqID3o=; b=Vvxha/Ux86+UrJdHAco6WaPmnwMgbW2Jl1kQ/vBi8Zyc8ZWVWwRf+cW99vfwNdjBc6 kJQYVBy8zTJeHuc4iqKRTM7nlSNhZUfshP1x4ACiYEZAIAXp87HsBs4jSLe3HfqC80g/ 1Nt3YRrUzZNVmEO/I+VX8N4XhoEk8muMihqa2cK3LhyNStQJU/RQBcY+u0wgFjNslOWH jjwp416VoPM4BDqJzkYtqu1FPqjxYyWmg+GPUqmyLyQCjQlwk/90K7UGUlWGppD300uS SN92hf+DrCKo7ojz6SU0PT0EaDBPGtbPiNJcckcsbVEHhQ9E9KMdRv06daVpvvvQmSef UXlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JNXA4eh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si235839ejd.240.2021.01.11.13.27.40; Mon, 11 Jan 2021 13:28:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JNXA4eh+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730444AbhAKVWJ (ORCPT + 99 others); Mon, 11 Jan 2021 16:22:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730374AbhAKVWG (ORCPT ); Mon, 11 Jan 2021 16:22:06 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA79C061795 for ; Mon, 11 Jan 2021 13:21:26 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id ce23so416789ejb.8 for ; Mon, 11 Jan 2021 13:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+AfvfCqsfaWkYAg6+USDuxUF1iByJwAHFmuzpuqID3o=; b=JNXA4eh+XvS7VbDRQow9rDSG63sK6s8viFtRvPQKLPQc5znp1NdUI+ZUf2P+tJOUmN msc82S/JFuJGrRoM96c06ABMd8qdGoW8j1IEzQwCVlvHzQ2imnfCuaccwTzaM35r4yoC 5ctGnMEryb+INkdAhzu1jnFQyEdFzL61rGkEb8VgJhPqyb/vETkhRofHD5JvBPLdcmwG j2JTXkJXSUQe4tun8gWbG4BaJx0oaPce60HdcO4m20+mGHVYG4kNbNbYYspvtF5AVi+w Zf2O2+H+VDOqksZzd2mznPvSOVOObBMI1J3ePh8ZKuDRL33S3wmmaqGxZ8ADVTGHjlO/ uJFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+AfvfCqsfaWkYAg6+USDuxUF1iByJwAHFmuzpuqID3o=; b=ShH/JzusuPgf8poglU1FFTu+dcZZrauwnrJRBDf/y9ZLOgMmp2iyvZhqIQX6aK2Oik yHP0FOy/3S18hYl5bhAYromEph5VxQYzRJ8eNzijMlFqYW8+zy6C7kiG/wCozlmQdb+n 88Qcg3p9w5EaqjlYfq+ZDQ6Y+n5OVe28QmzFX4lgiI4Fwaa9x9Du8Nde33+QxmuoBI9o coGaIiny8M9DmpwWXymAdLBYnzOZxS6DV55ciFMKj3VxJX6VHMI/h8kbjW6UeCvfAQ9m mRa58kHIueD4RYtx98dC+awZ6KD9rN8PNt9T5uymEcXqp5h1KUDXV6HEA02IZd7o3bNj 0K3A== X-Gm-Message-State: AOAM533GvHnlOYckHYBnxp3e7bvx+jKR7yLcB7UdGbbyAysuIz39357+ oyRNq80VwRhGwGkq5zHPZH/1p54hIvg9i9CaG9Y= X-Received: by 2002:a17:906:1a4e:: with SMTP id j14mr879710ejf.507.1610400084987; Mon, 11 Jan 2021 13:21:24 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Yang Shi Date: Mon, 11 Jan 2021 13:21:12 -0800 Message-ID: Subject: Re: [PATCH] mm: vmscan: support equal reclaim for anon and file pages To: Sudarshan Rajagopalan Cc: Linux MM , Linux Kernel Mailing List , Andrew Morton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 12:59 PM Sudarshan Rajagopalan wrote: > > When performing memory reclaim support treating anonymous and > file backed pages equally. > Swapping anonymous pages out to memory can be efficient enough > to justify treating anonymous and file backed pages equally. > > Signed-off-by: Sudarshan Rajagopalan > Cc: Andrew Morton > --- > mm/vmscan.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 257cba79a96d..ec7585e0d5f5 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -169,6 +169,8 @@ struct scan_control { > */ > int vm_swappiness = 60; > > +bool balance_anon_file_reclaim = false; I think the same effect could be achieved by adjusting swappiness. The "swappiness" can go to 200 now. Please check the document at Documentation/admin-guide/sysctl/vm.rst, it says: This control is used to define the rough relative IO cost of swapping and filesystem paging, as a value between 0 and 200. At 100, the VM assumes equal IO cost and will thus apply memory pressure to the page cache and swap-backed pages equally; lower values signify more expensive swap IO, higher values indicates cheaper. > + > static void set_task_reclaim_state(struct task_struct *task, > struct reclaim_state *rs) > { > @@ -201,6 +203,13 @@ static DECLARE_RWSEM(shrinker_rwsem); > static DEFINE_IDR(shrinker_idr); > static int shrinker_nr_max; > > +static int __init cmdline_parse_balance_reclaim(char *p) > +{ > + balance_anon_file_reclaim = true; > + return 0; > +} > +early_param("balance_reclaim", cmdline_parse_balance_reclaim); > + > static int prealloc_memcg_shrinker(struct shrinker *shrinker) > { > int id, ret = -ENOMEM; > @@ -2291,9 +2300,11 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, > > /* > * If there is enough inactive page cache, we do not reclaim > - * anything from the anonymous working right now. > + * anything from the anonymous working right now. But when balancing > + * anon and page cache files for reclaim, allow swapping of anon pages > + * even if there are a number of inactive file cache pages. > */ > - if (sc->cache_trim_mode) { > + if (!balance_anon_file_reclaim && sc->cache_trim_mode) { > scan_balance = SCAN_FILE; > goto out; > } > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > a Linux Foundation Collaborative Project > >