All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Leon Woestenberg" <leon.woestenberg@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Tejun Heo <tj@kernel.org>
Subject: Re: pci_map_sg() does not coalesce adjacent physical memory? x86
Date: Mon, 17 Nov 2008 19:15:32 -0800	[thread overview]
Message-ID: <20081117191532.c1c849f5.akpm@linux-foundation.org> (raw)
In-Reply-To: <c384c5ea0811171354u5d6f5be6v857f92b1e75769c7@mail.gmail.com>

(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);
> }
> 


  reply	other threads:[~2008-11-18  3:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17 21:54 pci_map_sg() does not coalesce adjacent physical memory? x86 Leon Woestenberg
2008-11-18  3:15 ` Andrew Morton [this message]
2008-11-18  5:21   ` James Bottomley
2008-11-18  9:37     ` Leon Woestenberg
2008-11-19  5:19   ` FUJITA Tomonori
2008-11-19  6:22     ` Leon Woestenberg
2008-11-19  6:58       ` FUJITA Tomonori
2008-11-19  7:05         ` FUJITA Tomonori
2008-11-19  7:58         ` FUJITA Tomonori
2008-11-19  9:45           ` Leon Woestenberg
2008-11-19 10:05             ` Tejun Heo

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=20081117191532.c1c849f5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=leon.woestenberg@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.