[Devel] [PATCH RHEL7 COMMIT] mm: add __GFP_ flag to hide verified high order allocation warnings

Konstantin Khorenko khorenko at virtuozzo.com
Thu Feb 14 17:29:07 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.11
------>
commit cae094878b537468167d817516890e1868ad0cac
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>
---
 include/linux/gfp.h | 2 ++
 mm/page_alloc.c     | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index c34ba0fa51d8..237596e6ce42 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -41,6 +41,7 @@ struct vm_area_struct;
 #define ___GFP_NO_KSWAPD	0x400000u
 #define ___GFP_OTHER_NODE	0x800000u
 #define ___GFP_WRITE		0x1000000u
+#define ___GFP_ORDER_NOWARN	0x2000000u
 /* If the above are modified, __GFP_BITS_SHIFT may need updating */
 
 /*
@@ -98,6 +99,7 @@ struct vm_area_struct;
 #define __GFP_NO_KSWAPD	((__force gfp_t)___GFP_NO_KSWAPD)
 #define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
 #define __GFP_WRITE	((__force gfp_t)___GFP_WRITE)	/* Allocator intends to dirty page */
+#define __GFP_ORDER_NOWARN ((__force gfp_t)___GFP_ORDER_NOWARN)
 
 /*
  * This may seem redundant, but it's a way of annotating false positives vs.
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 109011311e6d..74395116344b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3524,7 +3524,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