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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 20FEFC4338F for ; Tue, 10 Aug 2021 21:16:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B33D860F02 for ; Tue, 10 Aug 2021 21:16:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B33D860F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 332AD8D0002; Tue, 10 Aug 2021 17:16:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E3406B0072; Tue, 10 Aug 2021 17:16:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AAD98D0002; Tue, 10 Aug 2021 17:16:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 021AD6B0071 for ; Tue, 10 Aug 2021 17:16:25 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A6DFE1D58F for ; Tue, 10 Aug 2021 21:16:25 +0000 (UTC) X-FDA: 78460429530.38.916EBD9 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by imf12.hostedemail.com (Postfix) with ESMTP id 6651210055AE for ; Tue, 10 Aug 2021 21:16:25 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id z20so761624lfd.2 for ; Tue, 10 Aug 2021 14:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jvFV/sPpSnD57KASBlWu5g1n7aznLr5LbeGWzUFeD5E=; b=sBtl8D/ERsUsFcZL/DSOhagTs/HHF9rXwbhthcrPlVwsFYZxjbc2Akh+fMeCQbbRF/ oleiPAHFWd6YEzrc6Qc5kczFgQDdunmQ49ANRJWdKU36tTzoeybe0SsFwSWcTgXbPuf/ xfGmfVUoTFwhmgaB+fGRj9TzNy0X1Ywr21KXcQpArBsu7Ld/pzqzcOx27hytC4gkKI5z PUzBfOvPqiunGRDn/MkRohZOZQS4nwcy44RAoBIeapGzWjrXND1BrSpLKUz5WJdKW8Pq /FEkpC4BetAQBU5lqlx6v3blTMu1WvlycEy3pdYeb/Y9mjFZl1e9h5RPCZTewvuoExqQ B8nQ== 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=jvFV/sPpSnD57KASBlWu5g1n7aznLr5LbeGWzUFeD5E=; b=RXHwCXUvGPUraM9T8nN/RTAtWKM4L5QtWM4QnvkhleXBy6MInxWQiqP3riD0jcYhLG 7DS1/lRi7r55JXS9yixCdV8xdQB6NtKNdWADAN3l7LG8NGD3Yys6BLeGnrLdH4qvPg7e RMAJQ4O+8ceEKiNMKs8XdFLLJbAXj3G0KXTtGegQpZ9USmjuC2Gox1ND5hPacv9j9XlD ZaExxQxwr4FfZixI8aH62IE8J7OX3mFVX+yEqOyfslxl7o3EyUBHseQHDzE06qh9UxOd Bh7Y+mHoBc7HxYFs6mBTZGfjWKGxgUXzDdjBBbn6QMPGAS8cU9WLXHcWyqc80lGDOKEX ZSKQ== X-Gm-Message-State: AOAM531JTtTVnBwKmQfrlMyGMyoBxhZD5CknCAoQhYEwQ7uZC16lcEyY hA+4orhRoeO0YlDPJo9/cfWmD8/P6lxBETepsGhQvg== X-Google-Smtp-Source: ABdhPJzsGFnxcfx1wPp4UqsG78qF9NxE+WXImqmw44K30El9umyJ46EkWno8/KQYjD144O99zuI/BMm5+u+nLEGHnQ0= X-Received: by 2002:a05:6512:10d4:: with SMTP id k20mr12502520lfg.299.1628630183441; Tue, 10 Aug 2021 14:16:23 -0700 (PDT) MIME-Version: 1.0 References: <20210809223740.59009-1-npache@redhat.com> In-Reply-To: From: Shakeel Butt Date: Tue, 10 Aug 2021 14:16:12 -0700 Message-ID: Subject: Re: [PATCH v3] vm_swappiness=0 should still try to avoid swapping anon memory To: Johannes Weiner Cc: Nico Pache , Linux MM , Andrew Morton , LKML , Rafael Aquini , Waiman Long , Michal Hocko , hakavlad@inbox.lv Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b="sBtl8D/E"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf12.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=shakeelb@google.com X-Stat-Signature: z4x7k6wh8f8qo6wdjkp9dyiw3ssgpk9f X-Rspamd-Queue-Id: 6651210055AE X-Rspamd-Server: rspam01 X-HE-Tag: 1628630185-923174 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: Hi Johannes, On Tue, Aug 10, 2021 at 8:27 AM Johannes Weiner wrote: > [...] > One thing I think we should do - whether we need more on top or not - > is allowing file reclaim to continue when sc->file_is_tiny. Yes, we > also need anon to meet the watermarks, but it's not clear why we > should stop scanning file pages altogether: it's possible they get us > there 99% of the way, and somebody clearly wanted us to swap as little > as possible to end up in a situation like that, so: > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index eeab6611993c..90dac3dc9903 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2477,7 +2477,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, > * If the system is almost out of file pages, force-scan anon. > */ > if (sc->file_is_tiny) { > - scan_balance = SCAN_ANON; > + scan_balance = SCAN_EQUAL; > goto out; > } > Another thing we should do is to re-evaluate the sc->file_is_tiny condition. Currently it is: anon = node_page_state(pgdat, NR_INACTIVE_ANON); sc->file_is_tiny = file + free <= total_high_wmark && !(sc->may_deactivate & DEACTIVATE_ANON) && anon >> sc->priority; First convert node_page_state() usage to lruvec_page_state() for common source of truth. Second, in the commit b91ac374346b (sc->may_deactivate & DEACTIVATE_ANON) implies inactive_is_low(LRU_INACTIVE_ANON) but commit 170b04b7ae49 changed that. Was that intended? Third, the comment above this code says "Consider anon" but it is only considering inactive anon. Do we need to change the comment or the check?