linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nico Pache <npache@redhat.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: riel@surriel.com, mhocko@suse.com, shakeelb@google.com,
	iamjoonsoo.kim@lge.com, vbabka@suse.cz, hannes@cmpxchg.org,
	akpm@linux-foundation.org, aquini@redhat.com, longman@redhat.com
Subject: [RFC] vmscan: Scale file_is_tiny calculation based on priority
Date: Tue,  6 Dec 2022 15:23:15 -0700	[thread overview]
Message-ID: <20221206222315.37631-1-npache@redhat.com> (raw)

Now that reclaiming anon memory is more prevelant (Johannes describes this
well in commit f53af4285d77 ("mm: vmscan: fix extreme overreclaim and swap
floods")), we've been seeing large bursts (sometimes in the order of
multiple GiBs) of anon memory being reclaimed despite swappiness being
very low (=1) and there being plenty of page cache remaining.

Johannes commit f53af4285d77 ("mm: vmscan: fix extreme overreclaim and
swap floods"), helped reduce these swap storms; however, it did not fully
curb this effect. Under further investigation I noticed these swap
storms correspond to the activation of file_is_tiny.

file_is_tiny is being computed on a per-node basis, if reclaim
drains the page cache on one node, and the scheduler is prefering
new allocations on a separate node, file_is_tiny will remain elevated
for a very long time, constantly draining anon from the node that is low
on page cache.

These burst of reclaim are also seen in the single node case, where once
file_is_tiny=1, anon reclaim is too aggressive with a low swap value.

Reduce these extreme bursts of anon reclaim by scaling the total_high_wmark
down by the reclaim priority. This will activate file_is_tiny way less
often, and for smaller bursts.

Fixes: ccc5dc67340c ("mm/vmscan: make active/inactive ratio as 1:1 for anon lru")
Fixes: 5df741963d52 ("mm: fix LRU balancing effect of new transparent huge pages")
Signed-off-by: Nico Pache <npache@redhat.com>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 026199c047e0..0d288bb5354e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2882,7 +2882,7 @@ static void prepare_scan_count(pg_data_t *pgdat, struct scan_control *sc)
 		anon = node_page_state(pgdat, NR_INACTIVE_ANON);
 
 		sc->file_is_tiny =
-			file + free <= total_high_wmark &&
+			file + free <= (total_high_wmark >> sc->priority) &&
 			!(sc->may_deactivate & DEACTIVATE_ANON) &&
 			anon >> sc->priority;
 	}
-- 
2.38.1



                 reply	other threads:[~2022-12-06 22:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221206222315.37631-1-npache@redhat.com \
    --to=npache@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=mhocko@suse.com \
    --cc=riel@surriel.com \
    --cc=shakeelb@google.com \
    --cc=vbabka@suse.cz \
    /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).