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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466487018-5410-2-git-send-email-opensource.ganesh@gmail.com>
Date:	Tue, 21 Jun 2016 13:30:17 +0800
From:	Ganesh Mahendran <opensource.ganesh@...il.com>
To:	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc:	gregkh@...uxfoundation.org, arve@...roid.com,
	riandrews@...roid.com,
	Ganesh Mahendran <opensource.ganesh@...il.com>
Subject: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices

lowmem_count() should only count anon pages when we have swap device.

Signed-off-by: Ganesh Mahendran <opensource.ganesh@...il.com>
---
 drivers/staging/android/lowmemorykiller.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 6da9260..1d8de47 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -73,10 +73,14 @@ static unsigned long lowmem_deathpending_timeout;
 static unsigned long lowmem_count(struct shrinker *s,
 				  struct shrink_control *sc)
 {
-	return global_page_state(NR_ACTIVE_ANON) +
-		global_page_state(NR_ACTIVE_FILE) +
-		global_page_state(NR_INACTIVE_ANON) +
-		global_page_state(NR_INACTIVE_FILE);
+	unsigned long freeable = global_page_state(NR_ACTIVE_FILE) +
+				global_page_state(NR_INACTIVE_FILE);
+
+	if (get_nr_swap_pages() > 0)
+		freeable += global_page_state(NR_ACTIVE_ANON) +
+				global_page_state(NR_INACTIVE_ANON);
+
+	return freeable;
 }
 
 static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ