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: kmalloc memory slower than malloc
Date: Tue, 10 Sep 2013 12:44:20 +0100	[thread overview]
Message-ID: <20130910114420.GC12758@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE016A9EE8@039-SN2MPN1-023.039d.mgd.msft.net>

On Tue, Sep 10, 2013 at 11:36:34AM +0000, Duan Fugang-B38611 wrote:
> From: Thommy Jakobsson [mailto:thommyj at gmail.com] 
> Data: Tuesday, September 10, 2013 7:29 PM
> 
> > To: Duan Fugang-B38611
> > Cc: Lucas Stach; Thommy Jakobsson; linux-arm-kernel at lists.infradead.org
> > Subject: RE: kmalloc memory slower than malloc
> > 
> > 
> > 
> > On Tue, 10 Sep 2013, Duan Fugang-B38611 wrote:
> > 
> > > About the diff:
> > > dma_alloc_coherent in kernel   4.256s (s=0)
> > > dma_alloc_coherent userspace   0.566s (s=0)
> > >
> > > I think it call remap_pfn_range() with page attribute (vma->vm_page_prot)
> > transferred from mmap() maybe cacheable.
> > > So the performance is the same as malloc/kmalloc in userspace.
> > >
> > Thats probably true, or at least that is how I explained it to myself in
> > my head =)
> > 
> > Thanks,
> > Thommy
> 
> Can you add below code to your device_mmap() to test the performance for above two cases:
> 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

No, that is not match the page table settings that dma_mmap_coherent
would use.  That gets you strongly ordered memory which will be
(a) a violation of the ARM architecture requirements, being a different
"memory type", and (b) will be a different mapping type compared to
that used by the virtual address returned from dma_alloc_coherent().

The appropriate modification here would be pgprot_dmacoherent().

  reply	other threads:[~2013-09-10 11:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06  7:48 kmalloc memory slower than malloc Thommy Jakobsson
2013-09-06  8:07 ` Russell King - ARM Linux
2013-09-06  9:04   ` Thommy Jakobsson
2013-09-06  9:12 ` Lucas Stach
2013-09-06  9:36   ` Thommy Jakobsson
2013-09-10  9:54   ` Thommy Jakobsson
2013-09-10 10:10     ` Lucas Stach
2013-09-10 10:42       ` Duan Fugang-B38611
2013-09-10 11:28         ` Thommy Jakobsson
2013-09-10 11:36           ` Duan Fugang-B38611
2013-09-10 11:44             ` Russell King - ARM Linux [this message]
2013-09-10 12:42               ` Thommy Jakobsson
2013-09-10 12:50                 ` Russell King - ARM Linux
2013-09-12 15:58                   ` Thommy Jakobsson
2013-09-12 16:19                     ` Russell King - ARM Linux
2013-09-10 11:27       ` Thommy Jakobsson
2013-09-10 11:41     ` Russell King - ARM Linux
2013-09-10 12:54       ` Thommy Jakobsson

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=20130910114420.GC12758@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).