linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Mina Almasry <almasrymina@google.com>
Cc: Huang Ying <ying.huang@intel.com>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	 Yosry Ahmed <yosryahmed@google.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	weixugc@google.com,  shakeelb@google.com, gthelen@google.com,
	fvdl@google.com,  Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm: disable top-tier fallback to reclaim on proactive reclaim
Date: Mon, 5 Dec 2022 15:37:52 -0800	[thread overview]
Message-ID: <CAHbLzkpuJAx4LGpHMSfLUscsFR5Z5BRXdce2tPGdf=uHxfhCLQ@mail.gmail.com> (raw)
In-Reply-To: <20221201233317.1394958-1-almasrymina@google.com>

On Thu, Dec 1, 2022 at 3:33 PM Mina Almasry <almasrymina@google.com> wrote:
>
> Reclaiming directly from top tier nodes breaks the aging pipeline of
> memory tiers.  If we have a RAM -> CXL -> storage hierarchy, we
> should demote from RAM to CXL and from CXL to storage. If we reclaim
> a page from RAM, it means we 'demote' it directly from RAM to storage,
> bypassing potentially a huge amount of pages colder than it in CXL.
>
> However disabling reclaim from top tier nodes entirely would cause ooms
> in edge scenarios where lower tier memory is unreclaimable for whatever
> reason, e.g. memory being mlocked() or too hot to reclaim.  In these
> cases we would rather the job run with a performance regression rather
> than it oom altogether.
>
> However, we can disable reclaim from top tier nodes for proactive reclaim.
> That reclaim is not real memory pressure, and we don't have any cause to
> be breaking the aging pipeline.

Makes sense to me. Reviewed-by: Yang Shi <shy828301@gmail.com>

>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> ---
>  mm/vmscan.c | 27 ++++++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 23fc5b523764..6eb130e57920 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2088,10 +2088,31 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>         nr_reclaimed += demote_folio_list(&demote_folios, pgdat);
>         /* Folios that could not be demoted are still in @demote_folios */
>         if (!list_empty(&demote_folios)) {
> -               /* Folios which weren't demoted go back on @folio_list for retry: */
> +               /*
> +                * Folios which weren't demoted go back on @folio_list.
> +                */
>                 list_splice_init(&demote_folios, folio_list);
> -               do_demote_pass = false;
> -               goto retry;
> +
> +               /*
> +                * goto retry to reclaim the undemoted folios in folio_list if
> +                * desired.
> +                *
> +                * Reclaiming directly from top tier nodes is not often desired
> +                * due to it breaking the LRU ordering: in general memory
> +                * should be reclaimed from lower tier nodes and demoted from
> +                * top tier nodes.
> +                *
> +                * However, disabling reclaim from top tier nodes entirely
> +                * would cause ooms in edge scenarios where lower tier memory
> +                * is unreclaimable for whatever reason, eg memory being
> +                * mlocked or too hot to reclaim. We can disable reclaim
> +                * from top tier nodes in proactive reclaim though as that is
> +                * not real memory pressure.
> +                */
> +               if (!sc->proactive) {
> +                       do_demote_pass = false;
> +                       goto retry;
> +               }
>         }
>
>         pgactivate = stat->nr_activate[0] + stat->nr_activate[1];
> --
> 2.39.0.rc0.267.gcb52ba06e7-goog
>


      parent reply	other threads:[~2022-12-05 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 23:33 [PATCH v1] mm: disable top-tier fallback to reclaim on proactive reclaim Mina Almasry
2022-12-02  2:44 ` Huang, Ying
2022-12-02 21:38 ` Andrew Morton
2022-12-02 21:52   ` Mina Almasry
2022-12-05 23:37 ` Yang Shi [this message]

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='CAHbLzkpuJAx4LGpHMSfLUscsFR5Z5BRXdce2tPGdf=uHxfhCLQ@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=almasrymina@google.com \
    --cc=fvdl@google.com \
    --cc=gthelen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeelb@google.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=weixugc@google.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.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).