mm/cma.c: take __GFP_NOWARN into account in cma_alloc()
authorBoris Brezillon <>
Fri, 13 Oct 2017 22:58:01 +0000 (15:58 -0700)
committerLinus Torvalds <>
Fri, 13 Oct 2017 23:18:32 +0000 (16:18 -0700)
cma_alloc() unconditionally prints an INFO message when the CMA
allocation fails.  Make this message conditional on the non-presence of
__GFP_NOWARN in gfp_mask.

This patch aims at removing INFO messages that are displayed when the
VC4 driver tries to allocate buffer objects.  From the driver
perspective an allocation failure is acceptable, and the driver can
possibly do something to make following allocation succeed (like
flushing the VC4 internal cache).

Signed-off-by: Boris Brezillon <>
Acked-by: Laura Abbott <>
Cc: Jaewon Kim <>
Cc: David Airlie <>
Cc: Daniel Vetter <>
Cc: Eric Anholt <>
Cc: Joonsoo Kim <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

index c0da318c020e6c6d666ac8cf7cb92b2d4a47ceae..022e52bd83703e50408cc170b5ba91bcdb038aff 100644 (file)
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -460,7 +460,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
        trace_cma_alloc(pfn, page, count, align);
-       if (ret) {
+       if (ret && !(gfp_mask & __GFP_NOWARN)) {
                pr_info("%s: alloc failed, req-size: %zu pages, ret: %d\n",
                        __func__, count, ret);