Merge tag 'core-rcu-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / include / linux / mm.h
index 1c52d8f35d3d343f12d88cf6edeb47e9cf6d84f1..21115933b9b8e45bcd7d7b7282e55d238f8e7fae 100644 (file)
@@ -124,6 +124,16 @@ extern int mmap_rnd_compat_bits __read_mostly;
 #define lm_alias(x)    __va(__pa_symbol(x))
 #endif
 
+/*
+ * With CONFIG_CFI_CLANG, the compiler replaces function addresses in
+ * instrumented C code with jump table addresses. Architectures that
+ * support CFI can define this macro to return the actual function address
+ * when needed.
+ */
+#ifndef function_nocfi
+#define function_nocfi(x) (x)
+#endif
+
 /*
  * To prevent common memory management code establishing
  * a zero page mapping on a read fault.
@@ -2904,18 +2914,20 @@ static inline void kernel_poison_pages(struct page *page, int numpages) { }
 static inline void kernel_unpoison_pages(struct page *page, int numpages) { }
 #endif
 
-DECLARE_STATIC_KEY_FALSE(init_on_alloc);
+DECLARE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_ALLOC_DEFAULT_ON, init_on_alloc);
 static inline bool want_init_on_alloc(gfp_t flags)
 {
-       if (static_branch_unlikely(&init_on_alloc))
+       if (static_branch_maybe(CONFIG_INIT_ON_ALLOC_DEFAULT_ON,
+                               &init_on_alloc))
                return true;
        return flags & __GFP_ZERO;
 }
 
-DECLARE_STATIC_KEY_FALSE(init_on_free);
+DECLARE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_FREE_DEFAULT_ON, init_on_free);
 static inline bool want_init_on_free(void)
 {
-       return static_branch_unlikely(&init_on_free);
+       return static_branch_maybe(CONFIG_INIT_ON_FREE_DEFAULT_ON,
+                                  &init_on_free);
 }
 
 extern bool _debug_pagealloc_enabled_early;