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 131B2C433F5 for ; Thu, 19 May 2022 08:53:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FF566B0072; Thu, 19 May 2022 04:53:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8ADF86B0073; Thu, 19 May 2022 04:53:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79CE86B0074; Thu, 19 May 2022 04:53:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6B4296B0072 for ; Thu, 19 May 2022 04:53:50 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 44CD420BD3 for ; Thu, 19 May 2022 08:53:50 +0000 (UTC) X-FDA: 79481879820.25.A152048 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 2264080011 for ; Thu, 19 May 2022 08:53:46 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id m1so4218547plx.3 for ; Thu, 19 May 2022 01:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qb0g91B4uY7eJRc6xeHQ2DAiXKBk0/y0aultWo/u9CY=; b=RqwsFn2TEA+P6oiyLBWbQ+AUkd9t7DXfQDPEBNB4xm8lld/qbcQsgni+Qt8A5akZAn Q2TA2GnYSjn1HWpwrQ+vUkLlOFRN0Yuil/kEKYFfmAUk+ff6qXesxAWpmAnjVf6sT/HE KRI4OcTynB6Dq9rp0UvorxFA6Icz3Fs1sWZaegWjqOneg0BkOoj1MQ/aky19TaLNcYj9 yQucjjZZqQiMN5pWjvGh01DmYwwYrS1KQbq4zBPJfUg+aDGniz1u+gmkn/tAwOoxuvw/ wdjyFWOj8f1MfUQTxW/4/OOiGYuW7zFE7ArHBO44jp0CoTPpJ6sp8K8vpkWGAlzd2s3/ oQhg== 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=qb0g91B4uY7eJRc6xeHQ2DAiXKBk0/y0aultWo/u9CY=; b=NvAK7a4VgEgX64stKT8dQYMRFx37ksdeCfqnF8jmC6EmBw14iLP10t+2fYm/DpvYCO CedxlPG+38CorFiSP/z7eTglqRlKZvOqKMRAAXUmWRXwxKZWcK0FRkwJvKliPClVk47p V4h4lYZ789z6wBcyL1aViN9CqQCFK5tPPU5xO/mP7O+znMEFNiEvdvkTU1jLUgPOHojE tqxZ7eAHc/jYzckttNe53hLoQd5wQ21PLEeCXb1j7iZXPrx6pAJISPEKprkQs8cIajpT rB1rqaR7LNt+KVrMoTHuDO2zQ955M0OQSEINOarn/1rPCLB+oIhurjPEepko1zS9Fv+x Ci9w== X-Gm-Message-State: AOAM531PBrPsGaucEuhrGsnAk/tKwUCGF0Des7s636cQik9hrBKy7oZY NsQhNLSoRroNmhJjyxthFsV91w== X-Google-Smtp-Source: ABdhPJymegXU+LYRYsLtON1UbHo2oi9iTpwUvqyD3wXV6WQW0QT6iUUVcY3jUwxVTHWraQvQRe6peg== X-Received: by 2002:a17:902:a9c6:b0:15e:fe5d:cf67 with SMTP id b6-20020a170902a9c600b0015efe5dcf67mr3869503plr.74.1652950426842; Thu, 19 May 2022 01:53:46 -0700 (PDT) Received: from localhost ([139.177.225.250]) by smtp.gmail.com with ESMTPSA id p127-20020a622985000000b0050dc76281c1sm3486635pfp.155.2022.05.19.01.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 01:53:46 -0700 (PDT) Date: Thu, 19 May 2022 16:53:43 +0800 From: Muchun Song To: Johannes Weiner Cc: Dave Hansen , "Huang, Ying" , Yang Shi , Andrew Morton , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Zi Yan , Michal Hocko , Shakeel Butt , Roman Gushchin Subject: Re: [PATCH] Revert "mm/vmscan: never demote for memcg reclaim" Message-ID: References: <20220518190911.82400-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220518190911.82400-1-hannes@cmpxchg.org> X-Stat-Signature: 5x9d4tg537dnt9fnzi6toxzzbkz1j5t8 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2264080011 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=RqwsFn2T; spf=pass (imf02.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-HE-Tag: 1652950426-256514 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 Wed, May 18, 2022 at 03:09:11PM -0400, Johannes Weiner wrote: > This reverts commit 3a235693d3930e1276c8d9cc0ca5807ef292cf0a. > > Its premise was that cgroup reclaim cares about freeing memory inside > the cgroup, and demotion just moves them around within the cgroup > limit. Hence, pages from toptier nodes should be reclaimed directly. > > However, with NUMA balancing now doing tier promotions, demotion is > part of the page aging process. Global reclaim demotes the coldest > toptier pages to secondary memory, where their life continues and from > which they have a chance to get promoted back. Essentially, tiered > memory systems have an LRU order that spans multiple nodes. > > When cgroup reclaims pages coming off the toptier directly, there can > be colder pages on lower tier nodes that were demoted by global > reclaim. This is an aging inversion, not unlike if cgroups were to > reclaim directly from the active lists while there are inactive pages. > > Proactive reclaim is another factor. The goal of that it is to offload > colder pages from expensive RAM to cheaper storage. When lower tier > memory is available as an intermediate layer, we want offloading to > take advantage of it instead of bypassing to storage. > > Revert the patch so that cgroups respect the LRU order spanning the > memory hierarchy. > > Of note is a specific undercommit scenario, where all cgroup limits in > the system add up to <= available toptier memory. In that case, > shuffling pages out to lower tiers first to reclaim them from there is > inefficient. This is something could be optimized/short-circuited > later on (although care must be taken not to accidentally recreate the > aging inversion). Let's ensure correctness first. > > Signed-off-by: Johannes Weiner Reviewed-by: Muchun Song Thanks.