aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 297efcf05ba4..f9e4e647d7e8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -900,11 +900,13 @@ static struct fail_page_alloc_attr {
900 900
901 u32 ignore_gfp_highmem; 901 u32 ignore_gfp_highmem;
902 u32 ignore_gfp_wait; 902 u32 ignore_gfp_wait;
903 u32 min_order;
903 904
904#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS 905#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
905 906
906 struct dentry *ignore_gfp_highmem_file; 907 struct dentry *ignore_gfp_highmem_file;
907 struct dentry *ignore_gfp_wait_file; 908 struct dentry *ignore_gfp_wait_file;
909 struct dentry *min_order_file;
908 910
909#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ 911#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
910 912
@@ -912,6 +914,7 @@ static struct fail_page_alloc_attr {
912 .attr = FAULT_ATTR_INITIALIZER, 914 .attr = FAULT_ATTR_INITIALIZER,
913 .ignore_gfp_wait = 1, 915 .ignore_gfp_wait = 1,
914 .ignore_gfp_highmem = 1, 916 .ignore_gfp_highmem = 1,
917 .min_order = 1,
915}; 918};
916 919
917static int __init setup_fail_page_alloc(char *str) 920static int __init setup_fail_page_alloc(char *str)
@@ -922,6 +925,8 @@ __setup("fail_page_alloc=", setup_fail_page_alloc);
922 925
923static int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) 926static int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
924{ 927{
928 if (order < fail_page_alloc.min_order)
929 return 0;
925 if (gfp_mask & __GFP_NOFAIL) 930 if (gfp_mask & __GFP_NOFAIL)
926 return 0; 931 return 0;
927 if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM)) 932 if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM))
@@ -953,12 +958,17 @@ static int __init fail_page_alloc_debugfs(void)
953 fail_page_alloc.ignore_gfp_highmem_file = 958 fail_page_alloc.ignore_gfp_highmem_file =
954 debugfs_create_bool("ignore-gfp-highmem", mode, dir, 959 debugfs_create_bool("ignore-gfp-highmem", mode, dir,
955 &fail_page_alloc.ignore_gfp_highmem); 960 &fail_page_alloc.ignore_gfp_highmem);
961 fail_page_alloc.min_order_file =
962 debugfs_create_u32("min-order", mode, dir,
963 &fail_page_alloc.min_order);
956 964
957 if (!fail_page_alloc.ignore_gfp_wait_file || 965 if (!fail_page_alloc.ignore_gfp_wait_file ||
958 !fail_page_alloc.ignore_gfp_highmem_file) { 966 !fail_page_alloc.ignore_gfp_highmem_file ||
967 !fail_page_alloc.min_order_file) {
959 err = -ENOMEM; 968 err = -ENOMEM;
960 debugfs_remove(fail_page_alloc.ignore_gfp_wait_file); 969 debugfs_remove(fail_page_alloc.ignore_gfp_wait_file);
961 debugfs_remove(fail_page_alloc.ignore_gfp_highmem_file); 970 debugfs_remove(fail_page_alloc.ignore_gfp_highmem_file);
971 debugfs_remove(fail_page_alloc.min_order_file);
962 cleanup_fault_attr_dentries(&fail_page_alloc.attr); 972 cleanup_fault_attr_dentries(&fail_page_alloc.attr);
963 } 973 }
964 974