RE: Getting/Forcing Greater than 4KB Buffer Allocations

From: David Christensen <davidch_at_broadcom.com>
Date: Wed, 18 Jul 2007 20:09:15 -0700
>  > Thanks Pyun but I'm really just looking for a way to test 
> that I can
>  > handle the number of segments I've advertised that I can 
> support.  I 
>  > believe my code is correct but when all I see are allocations of 3 
>  > segments I just can't prove it.  I was hoping that running 
> a utility
>  > such as "stress" would help fragment memory and force more variable
>  > responses but that hasn't happened yet.
>  > 
> 
> It seems you've used the following code to create jumbo dma tag.
>         /*
>          * Create a DMA tag for RX mbufs.
>          */
>         if (bus_dma_tag_create(sc->parent_tag,
>                         1,
>                         BCE_DMA_BOUNDARY,
>                         sc->max_bus_addr,
>                         BUS_SPACE_MAXADDR,
>                         NULL, NULL,
>                         MJUM9BYTES,
>                         BCE_MAX_SEGMENTS,
>                         MJUM9BYTES,
>                         ^^^^^^^^^^
>                         0,
>                         NULL, NULL,
>                 &sc->rx_mbuf_tag)) {
>                 BCE_PRINTF("%s(%d): Could not allocate RX 
> mbuf DMA tag!\n",
>                         __FILE__, __LINE__);
>                 rc = ENOMEM;
>                 goto bce_dma_alloc_exit;
>         }
> If you want to have > 9 dma segements change maxsegsz(MJUM9BYTES) to
> 1024. bus_dma honors maxsegsz argument so you wouldn't get a dma
> segments larger than maxsegsz. With MJUM9BYTES maxsegsz you would get
> up to 4 dma segments on systems with 4K PAGE_SIZE.(You would have
> got up to 3 dma segements if you used PAGE_SIZE alignment argument.)

I don't want more segments, I just want to get a distribution of
segments
up to the max size I specified.  For example, since my BCE_MAX_SEGMENTS 
size is 8, I want to make sure I get mbufs that are spread over 1, 2, 3,
4, 5, 6, 7, and 8 segments.  

It turns out if I reduce the amount of memory in the system (from 8GB to
2GB) I will get more mbufs coalesced into 2 segments, rather than the
more typical 3 segments, but that's good enough for my testing now.

Dave
Received on Thu Jul 19 2007 - 01:09:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC