linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: skseofh@gmail.com
To: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Cc: Daero Lee <skseofh@gmail.com>
Subject: [PATCH] mm/vmscan.c: no need to double-check if free pages are under high-watermark
Date: Sun,  2 Jan 2022 12:31:29 +0900	[thread overview]
Message-ID: <20220102033129.12913-1-skseofh@gmail.com> (raw)

From: Daero Lee <skseofh@gmail.com>

In kswapd_try_to_sleep function, to check whether kswapd can sleep,
the prepare_kswapd_sleep function is called twice.

If free pages are below high-watermark in the first call,
the @remaining variable is not updated at 0 and the
prepare_kswapd_sleep function is called for the second time.

I think it is necessary to set the initial value of the
@remaining to a non-zero value to prevent consecutive calls
to the same function.

Signed-off-by: Daero Lee <skseofh@gmail.com>
---
 mm/vmscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 700434db5735..1217ecec5bbb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4331,7 +4331,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int highest_zoneidx)
 	/*
 	 * Return the order kswapd stopped reclaiming at as
 	 * prepare_kswapd_sleep() takes it into account. If another caller
-	 * entered the allocator slow path while kswapd was awake, order will
+	 * entered the allqocator slow path while kswapd was awake, order will
 	 * remain at the higher level.
 	 */
 	return sc.order;
@@ -4355,7 +4355,7 @@ static enum zone_type kswapd_highest_zoneidx(pg_data_t *pgdat,
 static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order,
 				unsigned int highest_zoneidx)
 {
-	long remaining = 0;
+	long remaining = ~0;
 	DEFINE_WAIT(wait);
 
 	if (freezing(current) || kthread_should_stop())
-- 
2.25.1



             reply	other threads:[~2022-01-02  3:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-02  3:31 skseofh [this message]
2022-01-06  0:17 ` [PATCH] mm/vmscan.c: no need to double-check if free pages are under high-watermark Andrew Morton
2022-01-06  9:46 ` Mel Gorman
2022-01-06 12:03   ` DaeRo Lee
2022-01-06 12:57     ` Mel Gorman
2022-03-26 15:50       ` Wei Yang
2022-04-07 13:56         ` Mel Gorman

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=20220102033129.12913-1-skseofh@gmail.com \
    --to=skseofh@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).