lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun,  2 Jan 2022 12:31:29 +0900
From:   skseofh@...il.com
To:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     Daero Lee <skseofh@...il.com>
Subject: [PATCH] mm/vmscan.c: no need to double-check if free pages are under high-watermark

From: Daero Lee <skseofh@...il.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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ