From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <20081002131607.946753246@chello.nl> References: <20081002130504.927878499@chello.nl> Date: Thu, 02 Oct 2008 15:05:10 +0200 From: Peter Zijlstra Subject: [PATCH 06/32] mm: expose gfp_to_alloc_flags() Content-Disposition: inline; filename=mm-gfp-to-alloc_flags-expose.patch Sender: owner-linux-mm@kvack.org Return-Path: 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 List-ID: 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; -- -- 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