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  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,  3 Jul 2011 12:39:23 -0700
From:	Dmitry Fink <finikk@...il.com>
To:	linux-mm@...ck.org
Cc:	linux-kernel@...r.kernel.org, Dmitry Fink <dmitry.fink@...m.com>
Subject: [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory

shmem pages can't be reclaimed and if they are swapped out
that doesn't affect the overall available memory in the system,
so don't count them along with the rest of the file backed pages.

Signed-off-by: Dmitry Fink <dmitry.fink@...m.com>
---
 mm/mmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index b88624f..3a34dc2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -119,6 +119,13 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 		unsigned long n;
 
 		free = global_page_state(NR_FILE_PAGES);
+
+		/* shmem pages shouldn't be counted as free in this
+		 * case, they can't be purged, only swapped out, and
+		 * that won't affect the overall amount of available
+		 * memory in the system. */
+		free -= global_page_state(NR_SHMEM);
+
 		free += nr_swap_pages;
 
 		/*
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists