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.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 29198C4338F for ; Tue, 10 Aug 2021 15:37:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C88F860462 for ; Tue, 10 Aug 2021 15:37:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C88F860462 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4B0AF6B0089; Tue, 10 Aug 2021 11:37:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 461606B008A; Tue, 10 Aug 2021 11:37:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32ACE6B008C; Tue, 10 Aug 2021 11:37:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 1641A6B0089 for ; Tue, 10 Aug 2021 11:37:21 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9E63B182DD9F6 for ; Tue, 10 Aug 2021 15:37:20 +0000 (UTC) X-FDA: 78459575040.08.06342F8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 326769001A83 for ; Tue, 10 Aug 2021 15:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628609839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kBYBVLFUuqcbHN0Vn7qdk9GROPKy6ZMoXPiOiWvTwPA=; b=hxmH2uxpJSafv0dk4im773s+8JyKaKr0uA70BtUwaWai1CL6ggNDvap90sWZc5vcbX4DzR o1ixlymA+6YJxgMTXDQjAswyaoJ6uMDIVzEiuMDFp15785f37eQZWUpkinZi9eagf4tOfa bPNbkWN/NSHFgvtle+dm4JZ8XFMbQeI= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-G2QN4yxXOCC6o7Wzxex48g-1; Tue, 10 Aug 2021 11:37:18 -0400 X-MC-Unique: G2QN4yxXOCC6o7Wzxex48g-1 Received: by mail-qt1-f197.google.com with SMTP id b19-20020ac84f130000b0290291372a1d17so5906910qte.9 for ; Tue, 10 Aug 2021 08:37:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=kBYBVLFUuqcbHN0Vn7qdk9GROPKy6ZMoXPiOiWvTwPA=; b=qU+obkj3NObomRoq5TV4hw7DRw0vOEY65abZR81Uy3LbknRk03tbZ5ONJS/jHqyt3i ZWlxxmYf4DmGlTsE45DuhURiM8z3W5PMFfpK3U90jdPd7V36+iC2K1mM+UFhxvOYn39G IBJurL6/fErrov5GGzqTpEPmZ/u5EgQNn6ADy9s6EeZlqqkcr/ndtKV/wexnMXnbJYWO 4FzKRh1wNK91XtwId7MHJGTMzDtcXdLFb5ba+phR1B1imC8/v1JpyP/ASVBlUcJ2Oogw 2Qsy5P0jpH6H1+4UXoa10Eo+obGdg+qa8W2ciOFTwRr6IRnjlUScYVH4SZUrZqBHAUcX PUaQ== X-Gm-Message-State: AOAM530vVZa9jGBuCaZRhhwYmg3t+QqjNutwNpo2lLgxl3i7TgXf1/qL Fl0DmnB7bLAED8EDsWkTzLbCZnFEvcY4A94CuclpXHleiGw5md6dUJQgQ/TzaApsjY2XQ1PB6Eu lkIk5yqLMGCg= X-Received: by 2002:a05:6214:f0c:: with SMTP id gw12mr18537907qvb.33.1628609837640; Tue, 10 Aug 2021 08:37:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOm0EFOKMF7EgqNWVhF6h0Ag5o+ey7u/ZRHLmnbXOgs9I+L3hLZXhW5JKjn8aYN/3AGF2qmw== X-Received: by 2002:a05:6214:f0c:: with SMTP id gw12mr18537893qvb.33.1628609837376; Tue, 10 Aug 2021 08:37:17 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id f17sm2970346qkm.107.2021.08.10.08.37.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Aug 2021 08:37:16 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH v3] vm_swappiness=0 should still try to avoid swapping anon memory To: Nico Pache , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Cc: hannes@cmpxchg.org, aquini@redhat.com, shakeelb@google.com, llong@redhat.com, mhocko@suse.com, hakavlad@inbox.lv References: <20210809223740.59009-1-npache@redhat.com> Message-ID: <88f76721-3786-625f-b867-216f7904e116@redhat.com> Date: Tue, 10 Aug 2021 11:37:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210809223740.59009-1-npache@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 326769001A83 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hxmH2uxp; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf29.hostedemail.com: domain of llong@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=llong@redhat.com X-Stat-Signature: 1dojgb3c3i8djufn1tykac78qmieos1n X-HE-Tag: 1628609840-334676 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 8/9/21 6:37 PM, Nico Pache wrote: > Since commit 170b04b7ae49 ("mm/workingset: prepare the workingset detection > infrastructure for anon LRU") and commit b91ac374346b ("mm: vmscan: enforce > inactive:active ratio at the reclaim root") swappiness can start prematurely > swapping anon memory. This is due to the assumption that refaulting anon should > always allow the shrinker to target anon memory. Add a check for swappiness > being >0 before indiscriminately targeting Anon. Before these commits > when a user had swappiness=0 anon memory would rarely get swapped; this > behavior has remained constant sense RHEL5. This commit keeps that behavior Typo: "sense" -> "since" > intact and prevents the new workingset refaulting from challenging the anon > memory when swappiness=0. > > Anon can still be swapped to prevent OOM. This does not completely disable > swapping, but rather tames the refaulting aspect of the code that allows for > the deactivating of anon memory. > > We have two customer workloads that discovered this issue: > 1) A VM claiming 95% of the hosts memory followed by file reads (never dirty) > which begins to challenge the anon. Refaulting the anon working set will then > cause the indiscriminant swapping of the anon. > > 2) A VM running a in-memory DB is being populated from file reads. > Swappiness is set to 0 or 1 to defer write I/O as much as possible. Once > the customer experienced low memory, swapping anon starts, with > little-to-no PageCache being swapped. Pagecache are not swapped. It is discarded under memory pressure and written back if dirty. Other than that, the patch looks good to me. Cheers, Longman