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 C499DC433F5 for ; Thu, 19 May 2022 05:11:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 517A66B0072; Thu, 19 May 2022 01:11:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A16F6B0073; Thu, 19 May 2022 01:11:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 341336B0074; Thu, 19 May 2022 01:11:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1E3556B0072 for ; Thu, 19 May 2022 01:11:45 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id EC978607EC for ; Thu, 19 May 2022 05:11:44 +0000 (UTC) X-FDA: 79481320128.02.6319C6D Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf27.hostedemail.com (Postfix) with ESMTP id 9D0E74000E for ; Thu, 19 May 2022 05:11:41 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-2fecc57ec14so37161787b3.11 for ; Wed, 18 May 2022 22:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cmzHfr/tzIaOpFcknLr2dzNk6szSsRhRNS5zlznLZ9M=; b=Hsh2y+tLr1ztijKLv8pNbAuZtGgMNZKaeS/+tihdOAw9OZRZgK8Y09uonswsQfsVBc yihsoK8f+1QtnhGaH/zfGD621ZmVzl0rldmYwpKvrtSyDErXQUoFnZdVNLmUv3U/vBZo 7NUnGfPAv0dqhDf7nkQW6ouOvGiZ3UyikHqUECpX5++9qZs+RJ8sGNuYjr5YbBp3zrEj 6BIhoQT9a9Pxw920WN5jc6SQwddir956v/0RqSuIjghjDtmcEutBla82S7NkGgT45xFz JYrcB6j12U5LibCvgo2kWcfQuUI9LsgtOjoqffpsbLJas5Y3oYD/DN+Mkn/YDxAuuyot zQjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cmzHfr/tzIaOpFcknLr2dzNk6szSsRhRNS5zlznLZ9M=; b=61j/tw8TSMrMhRupfver9w1Ohrki9sgYi3PNQQ18jgIfcjYisoHYAqk3bc3wLxW8QO 5BItEgpWzPVEdPP83QDeVISakDbrPGyihG0Y2IfJ6+6QgS2ohmxFPHKUvOGmhqNCoFWM HEW0mY//WUGnnkIZ4ZNJhRzAlrrtAxQ/yztjEF+NfmrjJrtpZuK7QCXynSFNOXPhyAcb xSpx1q4c9xhWBrimgG0rgOZHbwelhyO2Ypp8/5Vbfcyj6Cd6F/sh4N7/vs2GXrDJ6otY VT0vk2KtT3myytdfjml+6JXcNtmFP1fo1hYErnOeQzr9CA0X8ziCrjKFfMT4B++f6t0H ++ZQ== X-Gm-Message-State: AOAM533o+1ioZpMI5NsGzOcHiMVy7fokDr29Cc4uI8Fajn0XzHXv+fZd TzCANLtlXJu9HcKBX+H4G8kpORXz31SkNA== X-Google-Smtp-Source: ABdhPJwU010Tq9p4lmf0G/jI2g6ryHWv35ZyP+KyxlRYUzzjrgMNUmWGRd+Ibcs6qVy1ZfqpU7CJYdnPwukEOw== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:28b]) (user=shakeelb job=sendgmr) by 2002:a25:3b86:0:b0:64d:7480:5ca7 with SMTP id i128-20020a253b86000000b0064d74805ca7mr2628497yba.553.1652937103804; Wed, 18 May 2022 22:11:43 -0700 (PDT) Date: Thu, 19 May 2022 05:11:41 +0000 In-Reply-To: <20220518190911.82400-1-hannes@cmpxchg.org> Message-Id: <20220519050946.vzhgsxqgsmscgp2d@google.com> Mime-Version: 1.0 References: <20220518190911.82400-1-hannes@cmpxchg.org> Subject: Re: [PATCH] Revert "mm/vmscan: never demote for memcg reclaim" From: Shakeel Butt 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 , Roman Gushchin Content-Type: text/plain; charset="us-ascii" X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 9D0E74000E X-Stat-Signature: qc3cjmdcq6sjpiods7hu8abxcd3315ig Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Hsh2y+tL; spf=pass (imf27.hostedemail.com: domain of 3j9GFYggKCGQUJCMGGNDIQQING.EQONKPWZ-OOMXCEM.QTI@flex--shakeelb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3j9GFYggKCGQUJCMGGNDIQQING.EQONKPWZ-OOMXCEM.QTI@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1652937101-468920 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000100, 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 Acked-by: Shakeel Butt