Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1446776iob; Thu, 19 May 2022 06:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkRpcZ3FFZN2WrDokxiuxsuuukhyV4Ex+OKz4MeVEYXRXcHJntCwQA6BR/6N3BgTTk4xs1 X-Received: by 2002:a17:906:99c3:b0:6f4:a9d7:6dac with SMTP id s3-20020a17090699c300b006f4a9d76dacmr4361763ejn.85.1652968474847; Thu, 19 May 2022 06:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652968474; cv=none; d=google.com; s=arc-20160816; b=l6B2xlAiTtXrInXopmvMdN2YOYTt0q4QwBUOjjjBxH4W54aiViX4M50aBn3Spq7xsg aGayKTLShQXRodtHP4XHWWXk7AZkXg9s0nuaESv6PP74twgHM1oxtF9e+zhEgcTKtgwi 1NWRKh7UCfDrb5tfN4KCteU/9Riw3nJ3awrpxPPJGyvIhGtHk3L9HeOLUvBz1tmD14mx mCyFEnDUZqaLYrP6CNkv4k6SDBdpoNS65ZIFa5lobkPEGsjhZ6nAO+JH3xjgDUNNEAIv +HtsDyoD+YBsO+7yPoUA+AdrThARccLSykVSeO8ae8XQpUkDJdUzPpS79J0mNbykuq9G vH5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qb0g91B4uY7eJRc6xeHQ2DAiXKBk0/y0aultWo/u9CY=; b=gDxmxM6VO/TKQqDAztwAKyci5GX3P/EIZdW2r28VGckzEfz6TgxxtGSNpo044oeCtT kNNHHzZniAbr4i4KhHp4HRoxJbpb/jUUOR1lVyZY24+ZpS5HSP8IvbCaAVVRYZCqIX+8 HLiljxZpy9RSk8dUtwdbdHxy+eb0ofLS1htLo6Bo97azvds7LNavo3EuHwge7EYkmsUE CVVVDVu/YevZBfuRBkV9vDmuReWQJMWDJ4oYbeLZ7MyBs4AzQ7QYEBjKXvA1pVOKDjUo 9XMS6NYJWbTTNsfQeQgSYyIdEK2T1ZIemR/goEQhHCQFW2J54/B7qNnYCTUpBZ4he4QB 89Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=RqwsFn2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a056402281000b0041d79f5da31si6266128ede.534.2022.05.19.06.54.08; Thu, 19 May 2022 06:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=RqwsFn2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235669AbiESIxu (ORCPT + 99 others); Thu, 19 May 2022 04:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233498AbiESIxs (ORCPT ); Thu, 19 May 2022 04:53:48 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF9A9CF66 for ; Thu, 19 May 2022 01:53:47 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id gg20so4688199pjb.1 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=67gs7DvhF3zF7v2W/Zrm+6Z9YToZzJbp3sO2DcJ+ZLX7gCvTPZLxoM2Oyh23Fmkvwa aKW+yug5CT0tWjE+DYB7Us+Xt5oW8ZH7r0e3JHIotxf/zKvfk/eHkLAnzCBeOJbPYkWe EWDh/Fqy2Q9uMsEx3u1K07bhUUFkyqlm78Rf9eHzQMOdtb6J25dnqsk+iF+nQAovqtVZ mSZuWY/vwsqMMEjrOJkHPfTSpkgS8juhzj/cDrVIk9XtcHB48f+P8RiKsgAULUIVNW7R z3N4aGVwKqsVCiCCUvq+1VQrUE4pMEaQyKiiTETdGjodP1CUCOC8BwtXvH7tlwm6kSPc NlHA== X-Gm-Message-State: AOAM532snu/BlfW0QcZTpNUvjNPTcxrKKflFzbFcds4sMm//JdcEl2nN Zfj6cs1lVzlZTOvwGoKTxLL9rQ== 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.