[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <894F5F1132E3C5458AAB08FA0A1AC9380F1E2F12@IPX-MAIL.Intopix.com>
Date: Mon, 17 Oct 2011 07:51:53 +0000
From: Charles Buysschaert <Charles.Buysschaert@...opix.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Speed of RAM reserved with memmap kernel command line option.
Hello all,
We are writing a PCI-e "frame grabber-like" driver for linux 2.6 kernel.
For exchanging data with the board, we would like to be able to use a big piece of consecutive memory.
-> we reserve 512 megs after the first Gig of RAM by setting "memmap=512M$1024M" in grub.conf.
In order to give access to that memory in user space, I use "remap_pfn_range" :
int myboard_mmap(struct file *filep, struct vm_area_struct *vma) {
unsigned int board;
board = MINOR(filep->f_dentry->d_inode->i_rdev);
vma->vm_flags |= VM_LOCKED;
if(remap_pfn_range(vma, vma->vm_start, myboard_var[board].dmablkp>>PAGE_SHIFT, DMA_BUFFER_SIZE, vma->vm_page_prot)) {
printk(KERN_ERR "myboard: myboard_mmap: failed to mmap\n");
return -EAGAIN;
}
return 0;
}
(I have set myboard_var[board].dmablkp to the address I set in grub.conf: 0x40000000)
However when writing or reading that part of memory, speed is terrible.
I compared the performances to the ones I can reach using a piece of memory got with malloc:
For transfering 128 megs:
With malloc"ed" RAM : 23053us
With "mmap"ed RAM : 1913389us
I guess cache is not used. Does anyone know if there is a way to speed this up? How could we set that area to "cached"?
We have seen this post:
http://www.linux-mips.org/archives/linux-mips/2006-02/msg00120.html
And we tried adding this to our driver:
static inline pgprot_t pgprot_cached(pgprot_t _prot)
{
unsigned long prot = pgprot_val(_prot);
prot = (prot & ~_CACHE_MASK);
return __pgprot(prot);
}
vma->vm_page_prot = pgprot_cached(vma->vm_page_prot);
But it did not help...
Thank you in advance!
Best regards,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists