What's new

HOWTO [free pagecache, dentries and inodes]

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

K

krabs

Guest
Sometimes after running transmission or other services I only have left 60mb of free ram.

-->Clear linux memcache
check ram before and after using this command under Tools-sysinfo-free or with command free
first run sync so all cached objects are freed

Release memory used by the Linux kernel on caches

=1 --> to free pagecache

=2 --> to free dentries and inodes

=3 --> to free pagecache, dentries and inodes

Code:
sync; echo 3 > /proc/sys/vm/drop_caches

I let cron execute this every 6 hours so there's no unneeded swapping(if you have swap)

Code:
# /jffs/scripts/services-start
/usr/sbin/cru a clear_mem_cache "0 */6 * * *   sync; echo 3 > /proc/sys/vm/drop_caches"
 
You should have a look at adjusting the swapiness of your kernel rather than flat out flushing the caches. Using a least aggressive swapiness might ensure that caches get automatically flushed before hitting the swap.
 
You should have a look at adjusting the swapiness of your kernel rather than flat out flushing the caches. Using a least aggressive swapiness might ensure that caches get automatically flushed before hitting the swap.

I will do that.
You meant this I assume
Code:
/proc/sys/vm/swappiness

and what about this parameter?
Code:
/proc/sys/vm/vfs_cache_pressure
 
Sorry, I think it's a bad advice.
Sometimes after running transmission or other services I only have left 60mb of free ram.
That's normal and it's right. RAM is very valuable resource, it shouldn't be idle!

Take a look at this picture:

This is a embedded device with running torrent client. All free RAM used by LinuxVM for caches\buffers at high I\O load. It used to accelerate I\O operations. If we've got a piece of free RAM for acceleration, why we can't use it?

Free RAM is not a holy cow, it should be used as efficiently as possible.
 
Sorry, I think it's a bad advice.That's normal and it's right. RAM is very valuable resource, it shouldn't be idle!

Take a look at this picture:

This is a embedded device with running torrent client. All free RAM used by LinuxVM for caches\buffers at high I\O load. It used to accelerate I\O operations. If we've got a piece of free RAM for acceleration, why we can't use it?

Free RAM is not a holy cow, it should be used as efficiently as possible.

You're right but I mean when shutting down transmission, services after running it at night. Reclaim their cache so for browsing, etc it doesn't have to need swap. After shutting services down it isn't automatically freed so other services can use it instead of swap.
 
Just IMHO

Reclaim their cache so for browsing, etc it doesn't have to need swap. After shutting services down it isn't automatically freed so other services can use it instead of swap.
And this is right too. LinuxVM got some memory pages cached already. After shutting down transmission, why it must be flushed immediately while RAM is not used for other needs?

  • If those pages will be used in future, I\O operation will be accelerated well,
  • If not, it will be gradually replaced by other pages.

Believe me, we (mortal users:)) are not smarter than LinuxVM, let's do users task and let LinuxVM do system tasks.

PS Take a look how cached memory starts decreasing when I stopped torrent client:
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top