2009-04-28 01:37:18 mmap failure for nandflash
Leon He (CHINA)
Message: 73331
Hi, all
We need to map a file of nandflash yaffs to memory space by mmap(), because we are short of RAM when alloc() large size memory. But error always is returned, when we call "mmap()" as following:
mmap(NULL, length, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0 );
Detail of the error is "ENODEV (No such device)".
When I debugged into driver, I found the "mtd_type" of nandflash is set as "MTD_NANDFLASH", and this "mtd_type" cann't be mapped into "MAP_SHARED" mode.
Does this means nandflash yaffs cannot be mapped into memory space as "MAP_SHARED" mode?
Does this means it's impossible to extend memory by mmap() nandflash yaffs? Is there any work around for this situation?
BR // Leon
============================================================
Platform: CPU: bfin-527
SDRAM: 64M
Nandflash: 128M (as mtd yaffs)
Kernel: linux-2.6.x
QuoteReplyEditDelete
2009-04-28 01:42:28 Re: mmap failure for nandflash
Mike Frysinger (UNITED STATES)
Message: 73332
that would only make sense if the flash were directly addressable, or the Blackfin had virtual memory support. since neither are true, what you're doing cannot possibly work.
QuoteReplyEditDelete
2009-04-28 02:14:44 Re: mmap failure for nandflash
Leon He (CHINA)
Message: 73335
[1] . What you mean —— "directly addressable"? Sorry for may ignorance:(
What kind of flash support "directly address", our flash is "SAMSUNG501-K9F1G0800A"
[2] Actually we do have sufficent RAM in quantity, but memory pages is not large enough for larget memory requirement. We always get such information as following. What shall we do in such situation?
=====================================================================================
.....
mailr_test: page allocation failure. order:12, mode:0x40d0
.....
Mem-info:
DMA per-cpu:
CPU 0: Hot: hi: 18, btch: 3 usd: 5 Cold: hi: 6, btch: 1 usd: 0
Active:1827 inactive:1796 dirty:0 writeback:0 unstable:0
free:5785 slab:527 mapped:0 pagetables:0 bounce:0
DMA free:23140kB min:4096kB low:5120kB high:6144kB active:7308kB inactive:7184kB present:64008kB pages_scanned:14895 all_unreclaimable? no
lowmem_reserve[]: 0 0
DMA: 1*4kB 0*8kB 0*16kB 1*32kB 1*64kB 0*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 3*4096kB 1*8192kB 0*16384kB 0*32768kB = 23140kB
16127 pages of RAM
5808 free pages
687 reserved pages
0 pages shared
0 pages swap cached
Allocation of length 8392704 from process 167 failed
DMA per-cpu:
CPU 0: Hot: hi: 18, btch: 3 usd: 5 Cold: hi: 6, btch: 1 usd: 0
Active:1827 inactive:1796 dirty:0 writeback:0 unstable:0
free:5785 slab:527 mapped:0 pagetables:0 bounce:0
DMA free:23140kB min:4096kB low:5120kB high:6144kB active:7308kB inactive:7184kB present:64008kB pages_scanned:14895 all_unreclaimable? no
lowmem_reserve[]: 0 0
DMA: 1*4kB 0*8kB 0*16kB 1*32kB 1*64kB 0*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 3*4096kB 1*8192kB 0*16384kB 0*32768kB = 23140kB
=============================================================================================
QuoteReplyEditDelete
2009-04-28 02:26:26 Re: mmap failure for nandflash
Mike Frysinger (UNITED STATES)
Message: 73338
if the memory has dedicated address lines, it's directly addressable. if it doesnt, then it isnt. no NAND flash is directly addressable because it always goes through a controller interface.
if your memory is fragmenting, then dont do large allocations. the only other option is to aquire large chunks of memory *at boot* and never release them. trying to get 16megs of contiguous physical memory is rarely going to happen once the system boots.