linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Mina Almasry <almasrymina@google.com>
Cc: 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>,
	 Muchun Song <songmuchun@bytedance.com>,
	 linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	 linux-mm@kvack.org
Subject: Re: [RFC PATCH v1 3/4] mm: Fix demotion-only scanning anon pages
Date: Thu, 24 Nov 2022 13:27:51 +0800	[thread overview]
Message-ID: <87wn7korag.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <20221122203850.2765015-3-almasrymina@google.com> (Mina Almasry's message of "Tue, 22 Nov 2022 12:38:47 -0800")

Mina Almasry <almasrymina@google.com> writes:

> This is likely a missed change from commit a2a36488a61c ("mm/vmscan: Consider
> anonymous pages without swap"). Current logic is if !may_swap _or_
> !can_reclaim_anon_pages() then we don't scan anon memory.
>
> This should be an 'and'. We would like to scan anon memory if we may swap
> or if we can_reclaim_anon_pages().
>
> Fixes: commit a2a36488a61c ("mm/vmscan: Consider anonymous pages without swap")
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> ---
>  mm/vmscan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 8c1f5416d789..d7e509b3f07f 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2931,7 +2931,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
>  	enum lru_list lru;
>
>  	/* If we have no swap space, do not bother scanning anon folios. */
> -	if (!sc->may_swap || !can_reclaim_anon_pages(memcg, pgdat->node_id, sc)) {
> +	if (!sc->may_swap && !can_reclaim_anon_pages(memcg, pgdat->node_id, sc)) {

If there is only DRAM but swap device is enabled, sc->may_swap will not
work as expected.  So we should check can_demote() instead if
sc->may_swap.

Best Regards,
Huang, Ying

>  		scan_balance = SCAN_FILE;
>  		goto out;
>  	}
> --
> 2.38.1.584.g0f3c55d4c2-goog


  reply	other threads:[~2022-11-24  5:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 20:38 [RFC PATCH V1] mm: Disable demotion from proactive reclaim Mina Almasry
2022-11-22 20:38 ` [RFC PATCH v1] mm: Add memory.demote for proactive demotion only Mina Almasry
2022-11-22 20:38 ` [RFC PATCH v1 3/4] mm: Fix demotion-only scanning anon pages Mina Almasry
2022-11-24  5:27   ` Huang, Ying [this message]
2022-11-22 20:38 ` [RFC PATCH v1 4/4] mm: Add nodes= arg to memory.demote Mina Almasry
2022-11-23 18:00 ` [RFC PATCH V1] mm: Disable demotion from proactive reclaim Johannes Weiner
2022-11-23 21:20   ` Mina Almasry
2022-11-23 21:35     ` Yosry Ahmed
2022-11-23 22:30       ` Johannes Weiner
2022-11-23 23:47         ` Yosry Ahmed
2022-11-23 21:58     ` Johannes Weiner
2022-11-23 22:37       ` Mina Almasry
2022-11-24  5:51       ` Huang, Ying
2022-11-28 22:24         ` Yang Shi
2022-11-29  0:53           ` Huang, Ying
2022-11-29 17:27             ` Yang Shi
2022-11-30  5:31               ` Huang, Ying
2022-11-30 18:49                 ` Yang Shi
2022-12-01  1:51                   ` Huang, Ying
2022-12-01 22:45                     ` Yang Shi
2022-12-02  1:57                       ` Huang, Ying
2022-11-29 18:08         ` Johannes Weiner
2022-11-30  3:55           ` Huang, Ying
2022-12-01 20:40             ` Mina Almasry
2022-12-02  2:01               ` Huang, Ying
2022-12-02  2:06                 ` Mina Almasry
2022-11-30  2:14         ` Mina Almasry
2022-11-30  5:39           ` Huang, Ying
2022-11-30  6:06             ` Mina Almasry

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=87wn7korag.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=almasrymina@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=fvdl@google.com \
    --cc=gthelen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=weixugc@google.com \
    --cc=yang.shi@linux.alibaba.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