From: Yang Shi <shy828301@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
"Huang, Ying" <ying.huang@intel.com>,
Yang Shi <yang.shi@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>, Cgroups <cgroups@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kernel Team <kernel-team@fb.com>, Zi Yan <ziy@nvidia.com>,
Michal Hocko <mhocko@suse.com>,
Shakeel Butt <shakeelb@google.com>, Roman Gushchin <guro@fb.com>
Subject: Re: [PATCH] Revert "mm/vmscan: never demote for memcg reclaim"
Date: Wed, 18 May 2022 13:42:35 -0700 [thread overview]
Message-ID: <CAHbLzko400euGGZt-=q9AgSKpv0PAbgKvc7OJ7nOJCX3gQz2oQ@mail.gmail.com> (raw)
In-Reply-To: <20220518190911.82400-1-hannes@cmpxchg.org>
On Wed, May 18, 2022 at 12:09 PM Johannes Weiner <hannes@cmpxchg.org> 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.
Yes, exactly.
>
> 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.
Thanks for pointing this out, makes sense to me.
>
> 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.
Some side effects we might keep an eye with this revert:
- Limit reclaim may experience longer latency since it has to do
demotion + reclaim to uncharge enough memory
- Higher max usage due to the force charge from migration (of course
other migrations, i.e. NUMA fault, could have similar effect, but
anyway one more contributing factor)
They may not be noticeable hopefully, but I tend to agree that keeping
aging correct may be more important.
Reviewed-by: Yang Shi <shy828301@gmail.com>
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Yang Shi <yang.shi@linux.alibaba.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: Roman Gushchin <guro@fb.com>
> ---
> mm/vmscan.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index c6918fff06e1..7a4090712177 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -528,13 +528,8 @@ static bool can_demote(int nid, struct scan_control *sc)
> {
> if (!numa_demotion_enabled)
> return false;
> - if (sc) {
> - if (sc->no_demotion)
> - return false;
> - /* It is pointless to do demotion in memcg reclaim */
> - if (cgroup_reclaim(sc))
> - return false;
> - }
> + if (sc && sc->no_demotion)
> + return false;
> if (next_demotion_node(nid) == NUMA_NO_NODE)
> return false;
>
> --
> 2.36.1
>
>
next prev parent reply other threads:[~2022-05-18 20:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 19:09 [PATCH] Revert "mm/vmscan: never demote for memcg reclaim" Johannes Weiner
2022-05-18 19:51 ` Dave Hansen
2022-05-18 20:42 ` Yang Shi [this message]
2022-05-18 21:50 ` Roman Gushchin
2022-05-19 5:11 ` Shakeel Butt
2022-05-19 7:42 ` ying.huang
2022-05-23 18:59 ` Tim Chen
2022-05-19 8:53 ` Muchun Song
2022-05-19 9:51 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHbLzko400euGGZt-=q9AgSKpv0PAbgKvc7OJ7nOJCX3gQz2oQ@mail.gmail.com' \
--to=shy828301@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shakeelb@google.com \
--cc=yang.shi@linux.alibaba.com \
--cc=ying.huang@intel.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).