[Devel] [PATCH RHEL8 COMMIT] mm: add __GFP_ flag to hide verified high order allocation warnings
Konstantin Khorenko
khorenko at virtuozzo.com
Thu May 7 22:41:52 MSK 2020
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.3.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.3.8
------>
commit 41042c4108fbd0a700124301a21bd815fc69d67e
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Thu Feb 14 17:03:49 2019 +0300
mm: add __GFP_ flag to hide verified high order allocation warnings
Using __GFP_NOWARN to hide known high order allocation warnings
is not the best solution as it supresses allocation failures as well,
so let's add an independent __GFP_ORDER_NOWARN flag for that.
Fixes: 22b422587aab mm: add warning about high order allocations
https://pmc.acronis.com/browse/VSTOR-20383
https://pmc.acronis.com/browse/VSTOR-20349
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
https://jira.sw.ru/browse/PSBM-103814
(cherry picked from commit 66f0d9c1678847ee476af8d511839728d144c83b)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
include/linux/gfp.h | 9 +++++++--
mm/page_alloc.c | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index a6afcec53795..90084ff02484 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -39,8 +39,9 @@ struct vm_area_struct;
#define ___GFP_ACCOUNT 0x100000u
#define ___GFP_DIRECT_RECLAIM 0x200000u
#define ___GFP_KSWAPD_RECLAIM 0x400000u
+#define ___GFP_ORDER_NOWARN 0x800000u
#ifdef CONFIG_LOCKDEP
-#define ___GFP_NOLOCKDEP 0x800000u
+#define ___GFP_NOLOCKDEP 0x1000000u
#else
#define ___GFP_NOLOCKDEP 0
#endif
@@ -196,16 +197,20 @@ struct vm_area_struct;
* __GFP_COMP address compound page metadata.
*
* __GFP_ZERO returns a zeroed page on success.
+ *
+ * __GFP_ORDER_NOWARN suppresses reports about allocation of too high order
+ * pages.
*/
#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)
#define __GFP_COMP ((__force gfp_t)___GFP_COMP)
#define __GFP_ZERO ((__force gfp_t)___GFP_ZERO)
+#define __GFP_ORDER_NOWARN ((__force gfp_t)___GFP_ORDER_NOWARN)
/* Disable lockdep for GFP context tracking */
#define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
/* Room for N __GFP_FOO bits */
-#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))
+#define __GFP_BITS_SHIFT (24 + IS_ENABLED(CONFIG_LOCKDEP))
#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
/*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cbd6ee3ed01e..0a47163faa11 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4417,7 +4417,8 @@ static __always_inline void warn_high_order(int order, gfp_t gfp_mask)
if (static_key_false(&warn_high_order_key)) {
int tmp_warn_order = smp_load_acquire(&warn_order);
- if (order >= tmp_warn_order && !(gfp_mask & __GFP_NOWARN))
+ if (order >= tmp_warn_order &&
+ !(gfp_mask & (__GFP_NOWARN|__GFP_ORDER_NOWARN)))
WARN(atomic_dec_if_positive(&warn_count) >= 0,
"order %d >= %d, gfp 0x%x\n",
order, tmp_warn_order, gfp_mask);
More information about the Devel
mailing list