]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.suse/SoN-06-mm-gfp-to-alloc_flags-expose.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.suse / SoN-06-mm-gfp-to-alloc_flags-expose.patch
CommitLineData
2cb7cef9
BS
1From: Peter Zijlstra <a.p.zijlstra@chello.nl>
2Subject: mm: expose gfp_to_alloc_flags()
3Patch-mainline: No
4References: FATE#303834
5
6Expose the gfp to alloc_flags mapping, so we can use it in other parts
7of the vm.
8
9Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
10Acked-by: Neil Brown <neilb@suse.de>
11Acked-by: Suresh Jayaraman <sjayaraman@suse.de>
12
13---
14 mm/internal.h | 10 ++++++++++
15 mm/page_alloc.c | 10 +---------
16 2 files changed, 11 insertions(+), 9 deletions(-)
17
18--- a/mm/internal.h
19+++ b/mm/internal.h
20@@ -93,6 +93,16 @@ static inline struct page *mem_map_next(
21 #define __paginginit __init
22 #endif
23
24+#define ALLOC_HARDER 0x01 /* try to alloc harder */
25+#define ALLOC_HIGH 0x02 /* __GFP_HIGH set */
26+#define ALLOC_WMARK_MIN 0x04 /* use pages_min watermark */
27+#define ALLOC_WMARK_LOW 0x08 /* use pages_low watermark */
28+#define ALLOC_WMARK_HIGH 0x10 /* use pages_high watermark */
29+#define ALLOC_NO_WATERMARKS 0x20 /* don't check watermarks at all */
30+#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
31+
32+int gfp_to_alloc_flags(gfp_t gfp_mask);
33+
34 /* Memory initialisation debug and verification */
35 enum mminit_level {
36 MMINIT_WARNING,
37--- a/mm/page_alloc.c
38+++ b/mm/page_alloc.c
39@@ -1129,14 +1129,6 @@ failed:
40 return NULL;
41 }
42
43-#define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */
44-#define ALLOC_WMARK_MIN 0x02 /* use pages_min watermark */
45-#define ALLOC_WMARK_LOW 0x04 /* use pages_low watermark */
46-#define ALLOC_WMARK_HIGH 0x08 /* use pages_high watermark */
47-#define ALLOC_HARDER 0x10 /* try to alloc harder */
48-#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */
49-#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
50-
51 #ifdef CONFIG_FAIL_PAGE_ALLOC
52
53 static struct fail_page_alloc_attr {
54@@ -1463,7 +1455,7 @@ try_next_zone:
55 /*
56 * get the deepest reaching allocation flags for the given gfp_mask
57 */
58-static int gfp_to_alloc_flags(gfp_t gfp_mask)
59+int gfp_to_alloc_flags(gfp_t gfp_mask)
60 {
61 struct task_struct *p = current;
62 int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;