[PATCH] dma: iovlock: avoid dma_pin_iovec_pages() causing page allocator warns on order >= MAX_ORDER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dma_pin_iovec_pages() eventually causes the page allocator to stumble across
it warning case when a request for contigous mem block gets order >= MAX_ORDER.

   trinity(11230): Randomness reseeded to 0xaf76756f
   trinity: trinity(11230) Randomness reseeded to 0xaf76756f
   [ 7442.617160] ------------[ cut here ]------------
   [ 7442.621890] WARNING: at mm/page_alloc.c:2410 __alloc_pages_nodemask+0x346/0xa00()
   ...
   [ 7442.797088] Call Trace:
   [ 7442.799614]  [<ffffffff81600bf7>] dump_stack+0x19/0x1b
   [ 7442.804860]  [<ffffffff8105f621>] warn_slowpath_common+0x61/0x80
   [ 7442.810944]  [<ffffffff8105f6fa>] warn_slowpath_null+0x1a/0x20
   [ 7442.816858]  [<ffffffff8113d016>] __alloc_pages_nodemask+0x346/0xa00
   [ 7442.823294]  [<ffffffff81175f59>] alloc_pages_current+0xa9/0x170
   [ 7442.829364]  [<ffffffff811384be>] __get_free_pages+0xe/0x50
   [ 7442.835009]  [<ffffffff8118064e>] kmalloc_order_trace+0x2e/0xa0
   [ 7442.841005]  [<ffffffff81182899>] __kmalloc+0x219/0x230
   [ 7442.846284]  [<ffffffff81387c8b>] dma_pin_iovec_pages+0x9b/0x240
   [ 7442.852323]  [<ffffffff8153ffb8>] tcp_recvmsg+0x888/0xd10
   ...

dma_pin_iovec_pages() is actually being used for an unique callsite within
tcp_recvmsg() which falls back to skb_copy_datagram_iovec() if the first
routine fails to pin a DMA buffer for the iovec. The splatted calltrace is
more scary than other thing, so lets just prevent it from getting out to
the wild world. This patch also does a minor code style surgery on the
surrounding hunk.

Signed-off-by: Rafael Aquini <aquini@xxxxxxxxxx>
---
 drivers/dma/iovlock.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
index bb48a57..4cb8379 100644
--- a/drivers/dma/iovlock.c
+++ b/drivers/dma/iovlock.c
@@ -69,9 +69,10 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
 	} while (iovec_len_used < len);
 
 	/* single kmalloc for pinned list, page_list[], and the page arrays */
-	local_list = kmalloc(sizeof(*local_list)
-		+ (nr_iovecs * sizeof (struct dma_page_list))
-		+ (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
+	local_list = kmalloc(sizeof(*local_list) +
+			     (nr_iovecs * sizeof(struct dma_page_list)) +
+			     (iovec_pages_used * sizeof(struct page *)),
+			     GFP_KERNEL | __GFP_NOWARN);
 	if (!local_list)
 		goto out;
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux