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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEE1CC433F5 for ; Wed, 20 Apr 2022 18:45:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45D3B6B0071; Wed, 20 Apr 2022 14:45:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40B946B0073; Wed, 20 Apr 2022 14:45:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AC1F6B0074; Wed, 20 Apr 2022 14:45:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 199796B0071 for ; Wed, 20 Apr 2022 14:45:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id DBB0481417 for ; Wed, 20 Apr 2022 18:45:05 +0000 (UTC) X-FDA: 79378134570.04.07A5E06 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf20.hostedemail.com (Postfix) with ESMTP id 9D8D21C0026 for ; Wed, 20 Apr 2022 18:45:04 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id hh4so1633697qtb.10 for ; Wed, 20 Apr 2022 11:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GydGBqVOMdxK+zuMU2QjZP5eRGEp0WUH1oQpueOfZrk=; b=Oaxf+YEo72YwfG3w84fbVQ6plTOWo84uA6Oh1wiSP/uezqFsO5Yh4VvRVjGHpZ4XeN Dq6BsrWctnlAmfSohEhtHlE8Ti25xtgN1IG1lCNY/oRJ68olqL1YdpzrV2sAl4TAruk3 VKed6+D78UwKEBmAUp/cdqp0/UAIWHdUY4C1xsw9jF9tkWj6hdRKMLP6Ly6Ff5VvWueM dNgHqXATD+lvQ+cgwCgnkxMG8/yDzCVukwZvwO5lYvNLI9ydb32POZZVEmwmtXjXw4Uo td/OBrAgWjGH7pN+ZaCD7fahHHwotRs4BMX1chtLeRr/XvoImEMxrycMQOsuqx0E/S3i ES7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GydGBqVOMdxK+zuMU2QjZP5eRGEp0WUH1oQpueOfZrk=; b=FacWQynjKy+lW1lBoNJ6TgF7WsEZhXUoqPNIUv9CWhKDWJepanp+UC8aLcvcf/wt3/ pimVAeuFrUU9/OdtvcwVJ2/TJghit5kgI4sv17n5FgeRcZmgzCCOvvIQbMK05iTOvfJz tzbzEu3PxgXkoVx+coKAb/qpz/px0fwLR/1RWBSi8q3ijsDaPJztKp0R2ohcY4AkACV1 fJI+IqQHEJAwiuvNL9M77bNiQ0b5Jo5kj/7g/+j+zAnHJn/PyUmAxyBcqc+QYiiIyPfk HX365d4AKFeEZl1kRN6BW3zqeZpyCUMyJRNu/Id96sXZgFUHTJziHVZRStPC6pcXMTi4 iqdw== X-Gm-Message-State: AOAM532yVsRXALfPWA7uwY/0Q5+KSf+a1zNAXuOLUT+eCh3m+a2wNwi/ +g+cIls1us5Nb6VtdyaM6N93nw== X-Google-Smtp-Source: ABdhPJwqPAuuppufV9WBAwTkX6nejkfGfKtaVxHFmZofStks6sWGafgSrL64vTdo1Sdmwi7xr/OYnw== X-Received: by 2002:ac8:70da:0:b0:2f1:d195:cfaf with SMTP id g26-20020ac870da000000b002f1d195cfafmr14840662qtp.247.1650480304298; Wed, 20 Apr 2022 11:45:04 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:911d]) by smtp.gmail.com with ESMTPSA id n22-20020ac85b56000000b002f1d7a2867dsm2093902qtw.67.2022.04.20.11.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 11:45:03 -0700 (PDT) Date: Wed, 20 Apr 2022 14:44:32 -0400 From: Johannes Weiner To: Nico Pache Cc: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, aquini@redhat.com, shakeelb@google.com, llong@redhat.com, mhocko@suse.com, hakavlad@inbox.lv Subject: Re: [PATCH v3] vm_swappiness=0 should still try to avoid swapping anon memory Message-ID: References: <20210809223740.59009-1-npache@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=Oaxf+YEo; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Stat-Signature: ot79pcuw4xmk4ppwaizxkox53qjs169j X-Rspamd-Queue-Id: 9D8D21C0026 X-Rspamd-Server: rspam04 X-Rspam-User: X-HE-Tag: 1650480304-79301 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 Nico, On Wed, Apr 20, 2022 at 01:34:58PM -0400, Nico Pache wrote: > On 4/20/22 10:01, Johannes Weiner wrote: > >> My swappiness=0 solution was a minimal approach to regaining the 'avoid swapping > >> ANON' behavior that was previously there, but as Shakeel pointed out, there may > >> be something larger at play. > > > > So with my patch and swappiness=0 you get excessive swapping on v1 but > > not on v2? And the patch to avoid DEACTIVATE_ANON fixes it? > > correct, I haven't tested the DEACTIVATE_ANON patch since last time I was > working on this, but it did cure it. I can build a new kernel with it and verify > again. > > The larger issue is that our workload has regressed in performance. > > With V2 and swappiness=10 we are still seeing some swap, but very little tearing > down of THPs over time. With swappiness=0 it did some when swap but we are not > losings GBs of THPS (with your patch swappiness=0 has swap or THP issues on V2). > > With V1 and swappiness=(0|10)(with and without your patch), it swaps a ton and > ultimately leads to a significant amount of THP splitting. So the longer the > system/workload runs, the less likely we are to get THPs backing the guest and > the performance gain from THPs is lost. I hate to ask, but is it possible this is a configuration issue? One significant difference between V1 and V2 is that V1 has per-cgroup swappiness, which is inherited when the cgroup is created. So if you set sysctl vm.swappiness=0 after cgroups have been created, it will not update them. V2 cgroups do use vm.swappiness: static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) { /* Cgroup2 doesn't have per-cgroup swappiness */ if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) return vm_swappiness; /* root ? */ if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg)) return vm_swappiness; return memcg->swappiness; } Is it possible the job cgroups on V1 have swappiness=60? > So your patch does help return the old swappiness=0 behavior, but only for V2. Thanks for verifying. I'll prepare a proper patch.