[Devel] [PATCH rh7] x86/pci-dma: don't warn about high order in dma_alloc
Andrey Ryabinin
aryabinin at virtuozzo.com
Mon Feb 11 19:01:26 MSK 2019
dma_generic_alloc_coherent() requires physically contiguous memory,
hence there is no point in warning about high-order since we can't
do anything about it:
WARNING: CPU: 2 PID: 2072 at mm/page_alloc.c:3530 __alloc_pages_nodemask+0x311/0x610
order 3 >= 3, gfp 0x80d0
Call Trace:
dump_stack+0x19/0x1b
__warn+0xd8/0x100
warn_slowpath_fmt+0x5f/0x80
__alloc_pages_nodemask+0x311/0x610
dma_generic_alloc_coherent+0x8f/0x140
x86_swiotlb_alloc_coherent+0x21/0x50
ocrdma_alloc_q.isra.36+0xb6/0x110 [ocrdma]
ocrdma_init_hw+0x5bc/0x1520 [ocrdma]
ocrdma_add+0xe2/0x800 [ocrdma]
_be_roce_dev_add+0x18c/0x200 [be2net]
be_roce_register_driver+0x48/0x90 [be2net]
ocrdma_init_module+0x4a/0x1000 [ocrdma]
do_one_initcall+0xba/0x240
load_module+0x2796/0x2f50
SyS_init_module+0xef/0x140
system_call_fastpath+0x22/0x27
Add and use __GFP_ORDER_NOWARN to hide these warnings
https://pmc.acronis.com/browse/VSTOR-20383
https://pmc.acronis.com/browse/VSTOR-20349
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
arch/x86/kernel/pci-dma.c | 2 +-
include/linux/gfp.h | 2 ++
mm/page_alloc.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77a4e6222434..e0c605397a42 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -99,7 +99,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
dma_mask = dma_alloc_coherent_mask(dev, flag);
- flag |= __GFP_ZERO;
+ flag |= __GFP_ZERO | __GFP_ORDER_NOWARN;
again:
page = NULL;
/* CMA can be used only in the context which permits sleeping */
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);
--
2.19.2
More information about the Devel
mailing list