From: Shakeel Butt <shakeelb@google.com>
To: Nico Pache <npache@redhat.com>
Cc: Linux MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Rafael Aquini <aquini@redhat.com>
Subject: Re: [PATCH] vm_swappiness=0 should still try to avoid swapping anon memory
Date: Fri, 6 Aug 2021 18:00:51 -0700 [thread overview]
Message-ID: <CALvZod6gCof1bhVwdU7vYYKBRCn_HZBFi4BjSYoSK-dyrmswMA@mail.gmail.com> (raw)
In-Reply-To: <20210806231701.106980-1-npache@redhat.com>
On Fri, Aug 6, 2021 at 4:17 PM Nico Pache <npache@redhat.com> wrote:
>
> Since commit b91ac374346b ("mm: vmscan: enforce inactive:active ratio at the
> reclaim root") swappiness can start prematurely swapping anon memory.
> This is due to the assumption that refaulting anon should always allow
> the shrinker to target anon memory. Add a check for vm_swappiness being
> >0 before indiscriminately targeting Anon.
Did you actually observe this behavior?
>
> Signed-off-by: Nico Pache <npache@redhat.com>
> ---
> mm/vmscan.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 4620df62f0ff..8b932ff72e37 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2909,8 +2909,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc)
>
> refaults = lruvec_page_state(target_lruvec,
> WORKINGSET_ACTIVATE_ANON);
> - if (refaults != target_lruvec->refaults[0] ||
> - inactive_is_low(target_lruvec, LRU_INACTIVE_ANON))
> + if (vm_swappiness && (refaults != target_lruvec->refaults[0] ||
> + inactive_is_low(target_lruvec, LRU_INACTIVE_ANON)))
If you are really seeing the said behavior then why will this fix it.
This is just about deactivating active anon LRU. I would rather look
at get_scan_count() to check why swappiness = 0 is still letting the
kernel to scan anon LRU. BTW in cgroup v1, the memcg can overwrite
their swappiness which will be preferred over system vm_swappiness.
Did you set system level swappiness or memcg one?
> sc->may_deactivate |= DEACTIVATE_ANON;
> else
> sc->may_deactivate &= ~DEACTIVATE_ANON;
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-08-07 1:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 23:17 Nico Pache
2021-08-07 1:00 ` Shakeel Butt [this message]
2021-08-07 1:37 ` Nico Pache
2021-08-07 5:23 ` Shakeel Butt
2021-08-09 11:49 ` Michal Hocko
2021-08-09 22:31 ` Nico Pache
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=CALvZod6gCof1bhVwdU7vYYKBRCn_HZBFi4BjSYoSK-dyrmswMA@mail.gmail.com \
--to=shakeelb@google.com \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npache@redhat.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