linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeongtak Ji <hyeongtak.ji@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Hyeongtak Ji <hyeongtak.ji@gmail.com>,
	Hyeongtak Ji <hyeongtak.ji@sk.com>
Subject: [PATCH] mm/vmscan: consider previously reclaimed pages in shrink_lruvec()
Date: Mon,  7 Aug 2023 19:01:16 +0900	[thread overview]
Message-ID: <1691402476-4838-1-git-send-email-hyeongtak.ji@gmail.com> (raw)

shrink_lruvec() currently ignores previously reclaimed pages in
scan_control->nr_reclaimed.  This can lead shrink_lruvec() to reclaiming
more pages than expected.

This patch fixes shrink_lruvec() to take into account the previously
reclaimed pages.

Signed-off-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1080209a568b..315da4ae16f1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -6261,7 +6261,7 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
 	unsigned long nr_to_scan;
 	enum lru_list lru;
 	unsigned long nr_reclaimed = 0;
-	unsigned long nr_to_reclaim = sc->nr_to_reclaim;
+	unsigned long nr_to_reclaim = sc->nr_to_reclaim - sc->nr_reclaimed;
 	bool proportional_reclaim;
 	struct blk_plug plug;
 
-- 
2.7.4



             reply	other threads:[~2023-08-07 10:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 10:01 Hyeongtak Ji [this message]
2023-11-07 18:33 ` Johannes Weiner
2023-11-08 10:25   ` Hyeongtak Ji

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=1691402476-4838-1-git-send-email-hyeongtak.ji@gmail.com \
    --to=hyeongtak.ji@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hyeongtak.ji@sk.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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