From patchwork Thu Oct 2 13:05:10 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 2402 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 0A9EDDE15C for ; Thu, 2 Oct 2008 23:21:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754964AbYJBNUb (ORCPT ); Thu, 2 Oct 2008 09:20:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754724AbYJBNS7 (ORCPT ); Thu, 2 Oct 2008 09:18:59 -0400 Received: from casper.infradead.org ([85.118.1.10]:54806 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754698AbYJBNSz (ORCPT ); Thu, 2 Oct 2008 09:18:55 -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-0000Ec-MK; Thu, 02 Oct 2008 13:18:30 +0000 Received: by twins (Postfix, from userid 0) id 46000181EBCA6; Thu, 2 Oct 2008 15:18:30 +0200 (CEST) Message-Id: <20081002131607.946753246@chello.nl> References: <20081002130504.927878499@chello.nl> User-Agent: quilt/0.46-1 Date: Thu, 02 Oct 2008 15:05:10 +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 06/32] mm: expose gfp_to_alloc_flags() Content-Disposition: inline; filename=mm-gfp-to-alloc_flags-expose.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 Expose the gfp to alloc_flags mapping, so we can use it in other parts of the vm. Signed-off-by: Peter Zijlstra --- mm/internal.h | 10 ++++++++++ mm/page_alloc.c | 10 +--------- 2 files changed, 11 insertions(+), 9 deletions(-) Index: linux-2.6/mm/internal.h =================================================================== --- linux-2.6.orig/mm/internal.h +++ linux-2.6/mm/internal.h @@ -187,6 +187,16 @@ static inline void free_page_mlock(struc #define __paginginit __init #endif +#define ALLOC_HARDER 0x01 /* try to alloc harder */ +#define ALLOC_HIGH 0x02 /* __GFP_HIGH set */ +#define ALLOC_WMARK_MIN 0x04 /* use pages_min watermark */ +#define ALLOC_WMARK_LOW 0x08 /* use pages_low watermark */ +#define ALLOC_WMARK_HIGH 0x10 /* use pages_high watermark */ +#define ALLOC_NO_WATERMARKS 0x20 /* don't check watermarks at all */ +#define ALLOC_CPUSET 0x40 /* check for correct cpuset */ + +int gfp_to_alloc_flags(gfp_t gfp_mask); + /* Memory initialisation debug and verification */ enum mminit_level { MMINIT_WARNING, Index: linux-2.6/mm/page_alloc.c =================================================================== --- linux-2.6.orig/mm/page_alloc.c +++ linux-2.6/mm/page_alloc.c @@ -1122,14 +1122,6 @@ failed: return NULL; } -#define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */ -#define ALLOC_WMARK_MIN 0x02 /* use pages_min watermark */ -#define ALLOC_WMARK_LOW 0x04 /* use pages_low watermark */ -#define ALLOC_WMARK_HIGH 0x08 /* use pages_high watermark */ -#define ALLOC_HARDER 0x10 /* try to alloc harder */ -#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */ -#define ALLOC_CPUSET 0x40 /* check for correct cpuset */ - #ifdef CONFIG_FAIL_PAGE_ALLOC static struct fail_page_alloc_attr { @@ -1512,7 +1504,7 @@ static void set_page_owner(struct page * /* * get the deepest reaching allocation flags for the given gfp_mask */ -static int gfp_to_alloc_flags(gfp_t gfp_mask) +int gfp_to_alloc_flags(gfp_t gfp_mask) { struct task_struct *p = current; int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;