lkml.org 
[lkml]   [2008]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: pci_map_sg() does not coalesce adjacent physical memory? x86
(cc's added)

On Mon, 17 Nov 2008 22:54:33 +0100 "Leon Woestenberg" <leon.woestenberg@gmail.com> wrote:

> Hello,
>
> pci_map_sg() does not coalesce the scattergather list for me on x86.

In which kernel version(s)?

> Is this expected? Documentation mentions that coalescing is typically
> done by pci_map_sg().
>
> Manually traversing scatterlists that describe large user space
> allocations I found that on my system 25% reduction of list length can
> be achieved.
>
>
> static int sgm_map_to_table(struct sg_mapping_t *sgm)
> {
> int i, j = 0;
> dma_addr_t addr = sg_dma_address(&sgm->sgl[0]);
> unsigned int len = sg_dma_len(&sgm->sgl[0]);
> dma_addr_t cont_addr = addr;
> unsigned int cont_len = len;
> for (i = 0; i < sgm->mapped_pages - 1; i++) {
> dma_addr_t next = sg_dma_address(&sgm->sgl[i + 1]);
> len = sg_dma_len(&sgm->sgl[i]);
> printk(KERN_DEBUG "%04d: addr=0x%08x length=0x%08x\n",
> i, addr, len);
> /* page i + 1 is non-contiguous with page i? */
> if (next != addr + len) {
> /* TODO create entry here (we could overwrite i) */
> printk(KERN_DEBUG "%4d: cont_addr=0x%08x
> cont_len=0x%08x\n",
> j++, cont_addr, cont_len);
> cont_addr = next;
> cont_len = 0;
> }
> /* add page i + 1 to current contiguous block */
> cont_len += len;
> /* goto page i + 1 */
> addr = next;
> }
> /* TODO create entry here (we could overwrite i) */
> printk(KERN_DEBUG "%04d: addr=0x%08x length=0x%08x\n", i, addr, len);
> printk(KERN_DEBUG "%4d: cont_addr=0x%08x length=0x%08x\n",
> j++, cont_addr, cont_len);
> }
>



\
 
 \ /
  Last update: 2008-11-18 04:19    [W:0.066 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site