From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756110Ab1GCTk1 (ORCPT ); Sun, 3 Jul 2011 15:40:27 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:44452 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577Ab1GCTk0 (ORCPT ); Sun, 3 Jul 2011 15:40:26 -0400 From: Dmitry Fink To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Dmitry Fink Subject: [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory Date: Sun, 3 Jul 2011 12:39:23 -0700 Message-Id: <1309721963-5577-1-git-send-email-dmitry.fink@palm.com> X-Mailer: git-send-email 1.7.6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by kanga.kvack.org (Postfix) with ESMTP id DB42C6B0012 for ; Sun, 3 Jul 2011 15:40:28 -0400 (EDT) Received: by pzk4 with SMTP id 4so1008480pzk.14 for ; Sun, 03 Jul 2011 12:40:26 -0700 (PDT) From: Dmitry Fink Subject: [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory Date: Sun, 3 Jul 2011 12:39:23 -0700 Message-Id: <1309721963-5577-1-git-send-email-dmitry.fink@palm.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, 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 --- 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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org