[PATCH -mmotm 03/30] mm: expose gfp_to_alloc_flags()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Xiaotian Feng
Date: Tuesday, July 13, 2010 - 3:17 am

From 8a554f86ab2fd4d8a1daecaef4cc5bb3901c4423 Mon Sep 17 00:00:00 2001
From: Xiaotian Feng <dfeng@redhat.com>
Date: Mon, 12 Jul 2010 17:59:52 +0800
Subject: [PATCH 03/30] mm: expose gfp_to_alloc_flags()

Expose the gfp to alloc_flags mapping, so we can use it in other parts
of the vm.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
---
 mm/internal.h   |   15 +++++++++++++++
 mm/page_alloc.c |   16 +---------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/mm/internal.h b/mm/internal.h
index 6a697bb..3e2cc3a 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -185,6 +185,21 @@ static inline struct page *mem_map_next(struct page *iter,
 #define __paginginit __init
 #endif
 
+/* The ALLOC_WMARK bits are used as an index to zone->watermark */
+#define ALLOC_WMARK_MIN		WMARK_MIN
+#define ALLOC_WMARK_LOW		WMARK_LOW
+#define ALLOC_WMARK_HIGH	WMARK_HIGH
+#define ALLOC_NO_WATERMARKS	0x04 /* don't check watermarks at all */
+
+/* Mask to get the watermark bits */
+#define ALLOC_WMARK_MASK	(ALLOC_NO_WATERMARKS-1)
+
+#define ALLOC_HARDER		0x10 /* try to alloc harder */
+#define ALLOC_HIGH		0x20 /* __GFP_HIGH set */
+#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,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ebf0af7..72a6be5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1345,19 +1345,6 @@ failed:
 	return NULL;
 }
 
-/* The ALLOC_WMARK bits are used as an index to zone->watermark */
-#define ALLOC_WMARK_MIN		WMARK_MIN
-#define ALLOC_WMARK_LOW		WMARK_LOW
-#define ALLOC_WMARK_HIGH	WMARK_HIGH
-#define ALLOC_NO_WATERMARKS	0x04 /* don't check watermarks at all */
-
-/* Mask to get the watermark bits */
-#define ALLOC_WMARK_MASK	(ALLOC_NO_WATERMARKS-1)
-
-#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 {
@@ -1911,8 +1898,7 @@ void wake_all_kswapd(unsigned int order, struct zonelist *zonelist,
 		wakeup_kswapd(zone, order);
 }
 
-static inline 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;
-- 
1.7.1.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -mmotm 00/30] [RFC] swap over nfs -v21, Xiaotian Feng, (Tue Jul 13, 3:16 am)
[PATCH -mmotm 02/30] Swap over network documentation, Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 03/30] mm: expose gfp_to_alloc_flags(), Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 04/30] mm: tag reseve pages, Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 06/30] mm: kmem_alloc_estimate(), Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 08/30] mm: emergency pool, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 09/30] mm: system wide ALLOC_NO_WATERMARK, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 10/30] mm: __GFP_MEMALLOC, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 11/30] mm: memory reserve management, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 13/30] net: packet split receive api, Xiaotian Feng, (Tue Jul 13, 3:19 am)
[PATCH -mmotm 16/30] netvm: INET reserves, Xiaotian Feng, (Tue Jul 13, 3:19 am)
[PATCH -mmotm 18/30] netvm: filter emergency skbs, Xiaotian Feng, (Tue Jul 13, 3:20 am)
[PATCH -mmotm 21/30] netvm: skb processing, Xiaotian Feng, (Tue Jul 13, 3:20 am)
[PATCH -mmotm 26/30] nfs: enable swap on NFS, Xiaotian Feng, (Tue Jul 13, 3:21 am)
[PATCH -mmotm 28/30] build fix for skb_emergency_protocol, Xiaotian Feng, (Tue Jul 13, 3:22 am)
Re: [PATCH -mmotm 00/30] [RFC] swap over nfs -v21, Américo Wang, (Tue Jul 13, 5:53 am)