2009-02-18 07:56:52 memory issue with BF527
Maha lakshmi (INDIA)
Message: 69554
Hi,
After kernel bootup, meminfo shows
root:/home> cat /proc/meminfo
MemTotal: 61892 kB
MemFree: 48272 kB
Buffers: 12 kB
Cached: 7796 kB
SwapCached: 0 kB
Active: 908 kB
Inactive: 6888 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Slab: 1808 kB
SReclaimable: 1000 kB
SUnreclaim: 808 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 30944 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
My program was able to allocate memory after kenel bootup.
Then copied a file of size 18.1MB to BF527 and deleted it.
root:/home> cp /mnt/swf/nissan.swf .
root:/home> cat /proc/meminfo
MemTotal: 61892 kB
MemFree: 11120 kB
Buffers: 52 kB
Cached: 44852 kB
SwapCached: 0 kB
Active: 908 kB
Inactive: 43944 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Slab: 1864 kB
SReclaimable: 1008 kB
SUnreclaim: 856 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 30944 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
root:/home> rm nissan.swf
root:/home> cat /proc/meminfo
MemTotal: 61892 kB
MemFree: 29612 kB
Buffers: 52 kB
Cached: 26324 kB
SwapCached: 0 kB
Active: 908 kB
Inactive: 25468 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 0 kB
Mapped: 0 kB
Slab: 1864 kB
SReclaimable: 1008 kB
SUnreclaim: 856 kB
PageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 30944 kB
Committed_AS: 0 kB
VmallocTotal: 0 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
After this, My application was not able to allocate memory. My program tries to allocate 10 MB of memory then frees the memory.
Please tell me why I was not able to allocate memory again.
Thanks,
Maha
QuoteReplyEditDelete
2009-02-18 08:16:03 Re: memory issue with BF527
Ian Jeffray (UNITED KINGDOM)
Message: 69555
Research the differences between Linux and uCLinux. Specifically MMU vs no MMU. And what happens when you allocate memory.
Whilst you still have sufficient memory, it's not a contiguous block, so if your application is asking for a 10MB contiguous block, it will fail. Try asking for 10 x 1MB blocks and it'll (probably) succeed. This is basically unavoidable. If you really must have a 10MB contiguous block, allocate it early, and/or take it from non-kernel-managed space.
There's probably a FAQ on this, but I, like you, can't be bothered to look for a reference just now.
QuoteReplyEditDelete
2009-02-18 08:32:09 Re: memory issue with BF527
Michael Hennerich (GERMANY)
Message: 69557
Please closely watch Cached and MemFree.
You probably noticed that after coping the 18MB file 2x18MB disappeared from your free mem.
After you deleted the file in your ramfs only 18MB got back to your free mem.
The remaining one is still in your page cache.
Page cache reclaiming on NOMMU Linux doesn't work well.
Try:
root:/> echo 3 > /proc/sys/vm/drop_caches
and you will see that all your free mem came back.
What Release version are you using?
-Michael
QuoteReplyEditDelete
2009-02-18 08:50:35 Re: memory issue with BF527
Maha lakshmi (INDIA)
Message: 69560
Hi,
Thanks for your reply.
I tried echo 3 > /proc/sys/vm/drop_caches. I saw it's reclaming it's memory but still my application failes to allocate a bulk of 10MB even after that.
Thanks,
Maha
QuoteReplyEditDelete
2009-02-18 11:58:08 Re: memory issue with BF527
Robin Getz (UNITED STATES)
Message: 69576
Michael:
Page cache reclaiming works better after I added this to trunk - try it out, and see if it helps/makes things better.
# the default calculated values for these kernel controls are too small for
# an embedded nommu system, so override them. For more info check out
# - ./Documentation/sysctl/vm.txt
# - ./Documentation/filesystems/proc.txt
#
echo 4096 > /proc/sys/vm/min_free_kbytes
echo 300 > /proc/sys/vm/vfs_cache_pressure
-Robin