From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: [RFC][PATCH 2/2] throttle writers of shared mappings From: Peter Zijlstra In-Reply-To: References: <1146861313.3561.13.camel@lappy> <445CA22B.8030807@cyberone.com.au> <1146922446.3561.20.camel@lappy> <445CA907.9060002@cyberone.com.au> <1146929357.3561.28.camel@lappy> Content-Type: text/plain Date: Mon, 08 May 2006 21:24:23 +0200 Message-Id: <1147116263.16600.5.camel@lappy> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: Nick Piggin , Linus Torvalds , Andi Kleen , Rohit Seth , Andrew Morton , mbligh@google.com, hugh@veritas.com, riel@redhat.com, andrea@suse.de, arjan@infradead.org, apw@shadowen.org, mel@csn.ul.ie, marcelo@kvack.org, anton@samba.org, paulmck@us.ibm.com, linux-mm List-ID: From: Peter Zijlstra Now that we can detect writers of shared mappings, throttle them. Avoids OOM by surprise. Signed-off-by: Peter Zijlstra --- mm/memory.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: linux-2.6/mm/memory.c =================================================================== --- linux-2.6.orig/mm/memory.c 2006-05-08 18:20:49.000000000 +0200 +++ linux-2.6/mm/memory.c 2006-05-08 18:35:26.000000000 +0200 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -2183,8 +2184,11 @@ retry: unlock: pte_unmap_unlock(page_table, ptl); if (dirty) { + struct address_space *mapping = page_mapping(new_page); set_page_dirty(new_page); put_page(new_page); + if (mapping) + balance_dirty_pages_ratelimited_nr(mapping, 1); } return ret; oom: @@ -2304,8 +2308,11 @@ static inline int handle_pte_fault(struc unlock: pte_unmap_unlock(pte, ptl); if (page) { + struct address_space *mapping = page_mapping(page); set_page_dirty(page); put_page(page); + if (mapping) + balance_dirty_pages_ratelimited_nr(mapping, 1); } return VM_FAULT_MINOR; } -- 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/ . Don't email: email@kvack.org