2009-07-15 05:43:01 memory not freed up from romfs after rm
supriya d (INDIA)
Message: 77331
Hi,
I execute a application stored in romfs, then delete it from there while the application is still being executed. The deletion is successful and i do not see the application in romfs. But, the free memory in romfs doesnt increase.
For ex:
My application executable size is 4Mb, and romfs is 10Mb, then the free memory is around 5Mb. But after deleting the application, my romfs free memory still shows 5Mb.
Is this expected, because of the filesystem properties? or is there soemthing that I am missing?
If this is expected, then is there a way i can change this behaviour?
TIA
QuoteReplyEditDelete
2009-07-15 07:10:34 Re: memory not freed up from romfs after rm
Robin Getz (UNITED STATES)
Message: 77340
Supeiya:
You can't delete from romfs. What type of file system are you really using?
-Robin
QuoteReplyEditDelete
2009-07-15 07:36:57 Re: memory not freed up from romfs after rm
supriya d (INDIA)
Message: 77348
Hi Robin,
I have my root file system (ext2 fs), The memory used for this is SDRAM.
By romfs I am referring to the files created and stored as part of /bin, /etc and so on.
Thanks.
QuoteReplyEditDelete
2009-07-15 07:44:23 Re: memory not freed up from romfs after rm
Mike Frysinger (UNITED STATES)
Message: 77351
please dont use that term. "romfs" is a real read-only filesystem that is used in the embedded linux world.
you're probably using the ram disk (uclinux mtd map) ext2 rootfs. ram disks are cached, so deleting a file wont remove it from the page cache. if you want that, you have to flush all of the caches like normal:
echo 3 > /proc/sys/vm/drop_caches
QuoteReplyEditDelete
2009-07-15 07:44:35 Re: memory not freed up from romfs after rm
Robin Getz (UNITED STATES)
Message: 77352
Supriya:
How are you determining "free memory" in your ext2 file system? are you using "df"?
-Robin
QuoteReplyEditDelete
2009-07-15 07:55:45 Re: memory not freed up from romfs after rm
supriya d (INDIA)
Message: 77353
Hi Robin,
Yes I am checking free memory using df -h command.
Also I had tried on the drop_caches command, but do not see a difference.
the command that i tried was
echo 3> /proc/sys/vm/drop_caches
but since this didnt help i tried
echo 2> /proc/sys/vm/drop_caches as well
Thanks.
QuoteReplyEditDelete
2009-07-15 08:19:51 Re: memory not freed up from romfs after rm
Robin Getz (UNITED STATES)
Message: 77359
Supriya:
try "mount", and post the output.- if you are deleting files from mount points that are backed with ramfs - then it isn't going to effect the ext2 size. Where are you adding/removing files from?
-Robin
QuoteReplyEditDelete
2009-07-15 08:57:26 Re: memory not freed up from romfs after rm
supriya d (INDIA)
Message: 77363
Hi Robin,
Probably the following messages displayed when kernel comes up shoudl help,
Kernel command line: root=/dev/mtdblock0 rw
<<My comment: The above is what i have set in the Kernel command line in menuconfig>>
RAMDISK driver initialized: 8 RAM disks of 4096K size 1024 blocksize
uclinux[mtd]: RAM probe address=0x3d00000 size=0xe00000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00e00000 : "EXT2fs"
uclinux[mtd]: set EXT2fs:EXT2 to be root filesystem
VFS: Mounted root (ext2 filesystem).
So post this my root filesystem is mounted on mtdblock0. this mtdblock0 corresponds to my RAM address.
So, I am adding and removing files from rootfs mounted on /dev/mtdblock0.
When I delete the file it gets deleted, only that resources are not freed up if the application is still used.
But, when i kill the application i get back the resources/memory. So i suppose this is related to usage count, and inodes not getting freed up. Correct me if I am wrong here. I would like to know if this si the way it has to be, or something can be done to change this behaviour.
Thanks.
QuoteReplyEditDelete
2009-07-15 09:06:43 Re: memory not freed up from romfs after rm
Mike Frysinger (UNITED STATES)
Message: 77364
what you describe is how Linux operates -- this is by design and not a bug
QuoteReplyEditDelete
2009-07-15 09:13:40 Re: memory not freed up from romfs after rm
Robin Getz (UNITED STATES)
Message: 77368
Supriya:
I know how the kernel works. Can you do what I asked, and answer the question?
what directory are you adding/removing files from, and what is the output from "mount"?
-Robin