~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/mm/fail_page_alloc.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /mm/fail_page_alloc.c (Architecture i386) and /mm/fail_page_alloc.c (Architecture sparc64)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/fault-inject.h>                     2 #include <linux/fault-inject.h>
  3 #include <linux/error-injection.h>                  3 #include <linux/error-injection.h>
  4 #include <linux/mm.h>                               4 #include <linux/mm.h>
  5                                                     5 
  6 static struct {                                     6 static struct {
  7         struct fault_attr attr;                     7         struct fault_attr attr;
  8                                                     8 
  9         bool ignore_gfp_highmem;                    9         bool ignore_gfp_highmem;
 10         bool ignore_gfp_reclaim;                   10         bool ignore_gfp_reclaim;
 11         u32 min_order;                             11         u32 min_order;
 12 } fail_page_alloc = {                              12 } fail_page_alloc = {
 13         .attr = FAULT_ATTR_INITIALIZER,            13         .attr = FAULT_ATTR_INITIALIZER,
 14         .ignore_gfp_reclaim = true,                14         .ignore_gfp_reclaim = true,
 15         .ignore_gfp_highmem = true,                15         .ignore_gfp_highmem = true,
 16         .min_order = 1,                            16         .min_order = 1,
 17 };                                                 17 };
 18                                                    18 
 19 static int __init setup_fail_page_alloc(char *     19 static int __init setup_fail_page_alloc(char *str)
 20 {                                                  20 {
 21         return setup_fault_attr(&fail_page_all     21         return setup_fault_attr(&fail_page_alloc.attr, str);
 22 }                                                  22 }
 23 __setup("fail_page_alloc=", setup_fail_page_al     23 __setup("fail_page_alloc=", setup_fail_page_alloc);
 24                                                    24 
 25 bool should_fail_alloc_page(gfp_t gfp_mask, un     25 bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
 26 {                                                  26 {
 27         int flags = 0;                             27         int flags = 0;
 28                                                    28 
 29         if (order < fail_page_alloc.min_order)     29         if (order < fail_page_alloc.min_order)
 30                 return false;                      30                 return false;
 31         if (gfp_mask & __GFP_NOFAIL)               31         if (gfp_mask & __GFP_NOFAIL)
 32                 return false;                      32                 return false;
 33         if (fail_page_alloc.ignore_gfp_highmem     33         if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM))
 34                 return false;                      34                 return false;
 35         if (fail_page_alloc.ignore_gfp_reclaim     35         if (fail_page_alloc.ignore_gfp_reclaim &&
 36                         (gfp_mask & __GFP_DIRE     36                         (gfp_mask & __GFP_DIRECT_RECLAIM))
 37                 return false;                      37                 return false;
 38                                                    38 
 39         /* See comment in __should_failslab()      39         /* See comment in __should_failslab() */
 40         if (gfp_mask & __GFP_NOWARN)               40         if (gfp_mask & __GFP_NOWARN)
 41                 flags |= FAULT_NOWARN;             41                 flags |= FAULT_NOWARN;
 42                                                    42 
 43         return should_fail_ex(&fail_page_alloc     43         return should_fail_ex(&fail_page_alloc.attr, 1 << order, flags);
 44 }                                                  44 }
 45 ALLOW_ERROR_INJECTION(should_fail_alloc_page,      45 ALLOW_ERROR_INJECTION(should_fail_alloc_page, TRUE);
 46                                                    46 
 47 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS             47 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
 48                                                    48 
 49 static int __init fail_page_alloc_debugfs(void     49 static int __init fail_page_alloc_debugfs(void)
 50 {                                                  50 {
 51         umode_t mode = S_IFREG | 0600;             51         umode_t mode = S_IFREG | 0600;
 52         struct dentry *dir;                        52         struct dentry *dir;
 53                                                    53 
 54         dir = fault_create_debugfs_attr("fail_     54         dir = fault_create_debugfs_attr("fail_page_alloc", NULL,
 55                                         &fail_     55                                         &fail_page_alloc.attr);
 56                                                    56 
 57         debugfs_create_bool("ignore-gfp-wait",     57         debugfs_create_bool("ignore-gfp-wait", mode, dir,
 58                             &fail_page_alloc.i     58                             &fail_page_alloc.ignore_gfp_reclaim);
 59         debugfs_create_bool("ignore-gfp-highme     59         debugfs_create_bool("ignore-gfp-highmem", mode, dir,
 60                             &fail_page_alloc.i     60                             &fail_page_alloc.ignore_gfp_highmem);
 61         debugfs_create_u32("min-order", mode,      61         debugfs_create_u32("min-order", mode, dir, &fail_page_alloc.min_order);
 62                                                    62 
 63         return 0;                                  63         return 0;
 64 }                                                  64 }
 65                                                    65 
 66 late_initcall(fail_page_alloc_debugfs);            66 late_initcall(fail_page_alloc_debugfs);
 67                                                    67 
 68 #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */       68 #endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
 69                                                    69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php