All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory
@ 2011-07-03 19:39 ` Dmitry Fink
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Fink @ 2011-07-03 19:39 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, Dmitry Fink

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@palm.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


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-07-11 17:33 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03 19:39 [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory Dmitry Fink
2011-07-03 19:39 ` Dmitry Fink
2011-07-04  0:43 ` Minchan Kim
2011-07-04  0:43   ` Minchan Kim
2011-07-04  3:10   ` Dmitry Fink (Palm GBU)
2011-07-04  3:10     ` Dmitry Fink (Palm GBU)
2011-07-04  3:48     ` Minchan Kim
2011-07-04  3:48       ` Minchan Kim
2011-07-08 22:22 ` Hugh Dickins
2011-07-08 22:22   ` Hugh Dickins
2011-07-09 20:42   ` [PATCH] mmap: Fix and tidy up overcommit page arithmetic Dmitry Fink
2011-07-09 20:42     ` Dmitry Fink
2011-07-09 20:55     ` Dmitry Fink
2011-07-09 20:55       ` Dmitry Fink
2011-07-10 23:08       ` Minchan Kim
2011-07-10 23:08         ` Minchan Kim
2011-07-11  1:41         ` Dmitry Fink
2011-07-11  1:41           ` Dmitry Fink
2011-07-11 17:33           ` Hugh Dickins
2011-07-11 17:33             ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.