kmalloc memory slower than malloc

Duan Fugang-B38611 B38611 at freescale.com
Tue Sep 10 07:36:34 EDT 2013


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

I think the performance must be the same.

Regards,
Andy




More information about the linux-arm-kernel mailing list