From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: [PATCH 07/32] mm: tag reseve pages Date: Thu, 02 Oct 2008 15:05:11 +0200 Message-ID: <20081002131608.023485199@chello.nl> References: <20081002130504.927878499@chello.nl> To: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, trond.myklebust@fy Return-path: 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 Content-Disposition: inline; filename=page_alloc-reserve.patch Sender: netdev-owner@vger.kernel.org List-ID: 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); --