linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: alloc_safe_buffer/map_single problem related to ath9k on ARM
Date: Mon, 19 Sep 2011 23:36:48 +0100	[thread overview]
Message-ID: <20110919223648.GA28237@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <769353EF-E030-494A-B1FE-7D6614B2C1AF@comcast.net>

On Mon, Sep 19, 2011 at 03:26:54PM -0700, B. J. wrote:
> The original problem is that, under network load over the WiFi, I get
> these messages:
> 
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=87)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf733828!
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=174)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer c7ea4c5e!
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=1484)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf734028!
> 
> and eventually the system runs out of kernel memory and the OOM killer
> kicks in (yeah, so there's multiple problems here).

It shouldn't end up running out of memory - that implies there's a leak
somewhere.  And I think I know where it is - could you try this patch
please?  It won't solve the messages above but it should prevent the
resulting OOM.

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 0a0a1e7..c3ff82f 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -324,6 +324,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
 
 	if (addr)
 		*handle = pfn_to_dma(dev, page_to_pfn(page));
+	else
+		__dma_free_buffer(page, size);
 
 	return addr;
 }

      reply	other threads:[~2011-09-19 22:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 22:26 alloc_safe_buffer/map_single problem related to ath9k on ARM B. J.
2011-09-19 22:36 ` Russell King - ARM Linux [this message]

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=20110919223648.GA28237@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).