Author: cognet
Date: Sun Aug 11 21:21:02 2013
New Revision: 254229
URL: http://svnweb.freebsd.org/changeset/base/254229

Log:
  Only allocate 2 bounce pages for maps that can only use them for buffers that
  are unaligned on cache lines boundary, as we will never need more.

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- head/sys/arm/arm/busdma_machdep-v6.c        Sun Aug 11 21:15:04 2013        
(r254228)
+++ head/sys/arm/arm/busdma_machdep-v6.c        Sun Aug 11 21:21:02 2013        
(r254229)
@@ -425,6 +425,8 @@ bus_dma_tag_create(bus_dma_tag_t parent,
        if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr)
         || newtag->alignment > 1)
                newtag->flags |= BUS_DMA_COULD_BOUNCE;
+       else
+               maxsize = 2; /* Need at most 2 bounce pages for unaligned 
access on cache line boundaries */
 
        if ((flags & BUS_DMA_ALLOCNOW) != 0) {
                struct bounce_zone *bz;
@@ -519,7 +521,10 @@ static int allocate_bz_and_pages(bus_dma
         * Attempt to add pages to our pool on a per-instance
         * basis up to a sane limit.
         */
-       maxpages = MAX_BPAGES;
+       if (dmat->flags & BUS_DMA_COULD_BOUNCE)
+               maxpages = MAX_BPAGES;
+       else
+               maxpages = 2 * bz->map_count; /* Only need at most 2 pages for 
buffers unaligned on cache line boundaries */
        if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0
            || (bz->map_count > 0 && bz->total_bpages < maxpages)) {
                int pages;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to