From: Minchan Kim <minchan@kernel.org>
To: sumit.semwal@linaro.org, john.stultz@linaro.org
Cc: LKML <linux-kernel@vger.kernel.org>,
surenb@google.com, hridya@google.com, joaodias@google.com,
Minchan Kim <minchan@kernel.org>
Subject: [PATCH] dma-buf: system_heap: do not warn for costly allocation
Date: Wed, 10 Feb 2021 08:26:32 -0800 [thread overview]
Message-ID: <20210210162632.3903128-1-minchan@kernel.org> (raw)
Linux VM is not hard to support PAGE_ALLOC_COSTLY_ODER allocation
so normally expects driver passes __GFP_NOWARN in that case
if they has fallback options.
system_heap in dmabuf is the case so do not flood into demsg
with the warning for recording more precious information logs.
(below is ION warning example I got but dmabuf system heap is
nothing different).
[ 1233.911533][ T460] warn_alloc: 11 callbacks suppressed
[ 1233.911539][ T460] allocator@2.0-s: page allocation failure: order:4, mode:0x140dc2(GFP_HIGHUSER|__GFP_COMP|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0
[ 1233.926235][ T460] Call trace:
[ 1233.929370][ T460] dump_backtrace+0x0/0x1d8
[ 1233.933704][ T460] show_stack+0x18/0x24
[ 1233.937701][ T460] dump_stack+0xc0/0x140
[ 1233.941783][ T460] warn_alloc+0xf4/0x148
[ 1233.945862][ T460] __alloc_pages_slowpath+0x9fc/0xa10
[ 1233.951101][ T460] __alloc_pages_nodemask+0x278/0x2c0
[ 1233.956285][ T460] ion_page_pool_alloc+0xd8/0x100
[ 1233.961144][ T460] ion_system_heap_allocate+0xbc/0x2f0
[ 1233.966440][ T460] ion_buffer_create+0x68/0x274
[ 1233.971130][ T460] ion_buffer_alloc+0x8c/0x110
[ 1233.975733][ T460] ion_dmabuf_alloc+0x44/0xe8
[ 1233.980248][ T460] ion_ioctl+0x100/0x320
[ 1233.984332][ T460] __arm64_sys_ioctl+0x90/0xc8
[ 1233.988934][ T460] el0_svc_common+0x9c/0x168
[ 1233.993360][ T460] do_el0_svc+0x1c/0x28
[ 1233.997358][ T460] el0_sync_handler+0xd8/0x250
[ 1234.001989][ T460] el0_sync+0x148/0x180
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/dma-buf/heaps/system_heap.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 29e49ac17251..33c25a5e06f9 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -40,7 +40,7 @@ struct dma_heap_attachment {
bool mapped;
};
-#define HIGH_ORDER_GFP (((GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN \
+#define HIGH_ORDER_GFP (((GFP_HIGHUSER | __GFP_ZERO \
| __GFP_NORETRY) & ~__GFP_RECLAIM) \
| __GFP_COMP)
#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO | __GFP_COMP)
@@ -315,6 +315,7 @@ static struct page *alloc_largest_available(unsigned long size,
unsigned int max_order)
{
struct page *page;
+ unsigned long gfp_flags;
int i;
for (i = 0; i < NUM_ORDERS; i++) {
@@ -323,7 +324,11 @@ static struct page *alloc_largest_available(unsigned long size,
if (max_order < orders[i])
continue;
- page = alloc_pages(order_flags[i], orders[i]);
+ gfp_flags = order_flags[i];
+ if (orders[i] > PAGE_ALLOC_COSTLY_ORDER)
+ gfp_flags |= __GFP_NOWARN;
+
+ page = alloc_pages(gfp_flags, orders[i]);
if (!page)
continue;
return page;
--
2.30.0.478.g8a0d178c01-goog
next reply other threads:[~2021-02-10 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 16:26 Minchan Kim [this message]
2021-02-10 17:24 ` [PATCH] dma-buf: system_heap: do not warn for costly allocation Suren Baghdasaryan
2021-02-10 17:41 ` Minchan Kim
2021-02-10 17:32 ` John Stultz
2021-02-10 17:48 ` Minchan Kim
2021-02-10 21:40 ` John Stultz
2021-02-10 23:17 ` Minchan Kim
2021-02-11 2:14 ` John Stultz
2021-02-11 2:30 ` Minchan Kim
2021-02-10 21:12 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210210162632.3903128-1-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=hridya@google.com \
--cc=joaodias@google.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=surenb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox