From patchwork Thu Oct 2 13:05:11 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 2392 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 6A72EDE2BA for ; Thu, 2 Oct 2008 23:19:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754883AbYJBNTf (ORCPT ); Thu, 2 Oct 2008 09:19:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754881AbYJBNTe (ORCPT ); Thu, 2 Oct 2008 09:19:34 -0400 Received: from casper.infradead.org ([85.118.1.10]:54830 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754847AbYJBNT1 (ORCPT ); Thu, 2 Oct 2008 09:19:27 -0400 Received: from d9244.upc-d.chello.nl ([213.46.9.244] helo=twins) by casper.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux)) id 1KlO4c-0000Ed-N0; Thu, 02 Oct 2008 13:18:30 +0000 Received: by twins (Postfix, from userid 0) id 47A10181EBCA7; Thu, 2 Oct 2008 15:18:30 +0200 (CEST) Message-Id: <20081002131608.023485199@chello.nl> References: <20081002130504.927878499@chello.nl> User-Agent: quilt/0.46-1 Date: Thu, 02 Oct 2008 15:05:11 +0200 From: Peter Zijlstra To: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, trond.myklebust@fys.uio.no, Daniel Lezcano , Pekka Enberg , Peter Zijlstra , Neil Brown , David Miller Subject: [PATCH 07/32] mm: tag reseve pages Content-Disposition: inline; filename=page_alloc-reserve.patch X-Bad-Reply: References but no 'Re:' in Subject. Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Tag pages allocated from the reserves with a non-zero page->reserve. This allows us to distinguish and account reserve pages. Since low-memory situations are transient, and unrelated the the actual page (any page can be on the freelist when we run low), don't mark the page in any permanent way - just pass along the information to the allocatee. Signed-off-by: Peter Zijlstra --- include/linux/mm_types.h | 1 + mm/page_alloc.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) Index: linux-2.6/include/linux/mm_types.h =================================================================== --- linux-2.6.orig/include/linux/mm_types.h +++ linux-2.6/include/linux/mm_types.h @@ -70,6 +70,7 @@ struct page { union { pgoff_t index; /* Our offset within mapping. */ void *freelist; /* SLUB: freelist req. slab lock */ + int reserve; /* page_alloc: page is a reserve page */ }; struct list_head lru; /* Pageout list, eg. active_list * protected by zone->lru_lock ! Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c +++ linux-2.6/mm/page_alloc.c @@ -1433,8 +1433,10 @@ zonelist_scan: } page = buffered_rmqueue(preferred_zone, zone, order, gfp_mask); - if (page) + if (page) { + page->reserve = !!(alloc_flags & ALLOC_NO_WATERMARKS); break; + } this_zone_full: if (NUMA_BUILD) zlc_mark_zone_full(zonelist, z);