LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-19-2010, 04:24 PM   #1
seaquesttr
LQ Newbie
 
Registered: Feb 2010
Posts: 9

Rep: Reputation: 0
Highly cached memory with buffer_head type cache


On my system with 16 G of ram, ram is full of cached data, at the end of the day. Most of the cached data is buffer_head type. AFAIK buffer_head is about mapping sectors of physical disk to memory.

- Is this status normal? Why kernel should not free cached memory?
- Will the situation have effects on the performance f the system. For example, swapping.
- How can I resolv the problem. Or should I accept as normal.

regards,


top:

Mem: 16633388k total, 16089760k used, 543628k free, 315296k buffers
Swap: 4399532k total, 96k used, 4399436k free, 14624576k cached

free:
total used free shared buffers cached
Mem: 16633388 16089704 543684 0 315308 14624592
-/+ buffers/cache: 1149804 15483584
Swap: 4399532 96 4399436


# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d1p1 9920592 2711904 6696620 29% /
/dev/cciss/c0d1p5 399696092 78576380 300488640 21% /var
/dev/cciss/c0d1p2 4956316 143108 4557376 4% /tmp
/dev/cciss/c0d0p1 194442 11194 173209 7% /boot
tmpfs 8316692 0 8316692 0% /dev/shm

# slabtop
Active / Total Objects (% used) : 1731551 / 1778509 (97.4%)
Active / Total Slabs (% used) : 37209 / 37331 (99.7%)
Active / Total Caches (% used) : 101 / 145 (69.7%)
Active / Total Size (% used) : 135210.79K / 142038.93K (95.2%)
Minimum / Average / Maximum Object : 0.01K / 0.08K / 128.00K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1507248 1505309 99% 0.05K 20934 72 83736K buffer_head
85190 85167 99% 0.27K 6085 14 24340K radix_tree_node
51504 51155 99% 0.13K 1776 29 7104K dentry_cache
27676 20513 74% 0.09K 629 44 2516K vm_area_struct
17712 14315 80% 0.48K 2214 8 8856K ext3_inode_cache
11560 7654 66% 0.19K 578 20 2312K filp
9266 5449 58% 0.03K 82 113 328K size-32
9145 4420 48% 0.06K 155 59 620K size-64
6350 5708 89% 0.01K 25 254 100K anon_vma

# sysctl -a |grep dirty
vm.dirty_expire_centisecs = 2999
vm.dirty_writeback_centisecs = 499
vm.dirty_ratio = 8
vm.dirty_background_ratio = 2

# sysctl -a |grep commit
vm.overcommit_ratio = 50
vm.overcommit_memory = 0

Kernel is 2.6.18-162 from latest Centos EL5
 
Old 02-21-2010, 01:36 PM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
AFAIK the kernel will freeing memory only when it need it, and keep as much cache as possible. That's why on a Linux system, RAM is always full.
 
1 members found this post helpful.
Old 02-21-2010, 02:51 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
- Is this status normal?
Yes

Quote:
Why kernel should not free cached memory?
Why should it? Cached memory means that the system doesn't have to perform an IO to access the cached data. Cached data is read-only, and can be abandoned at will by the kernel without an IO action.

Quote:
- Will the situation have effects on the performance f the system. For example, swapping.
Yes, caching actually improves the performance of your system, otherwise they wouldn't have coded it into the kernel. It will not cause it to swap.

Quote:
- How can I resolv the problem. Or should I accept as normal.
There is no problem.
 
1 members found this post helpful.
Old 02-21-2010, 07:47 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by seaquesttr View Post
Most of the cached data is buffer_head type.
No it isn't - don't confuse slab usage (which is minute in the grand scheme of things) with page cache.
Despite the common use of the term "cache", each is caching something totally different. And of course there are hardware caches as well - (multiple) in the CPU as well as things like disk controllers. The term is used everywhere - describing function, not the specific storage usage.

As for your slabtop output, that by default sorts by object count - hit the "c" key whilst in slabtop to sort by usage. Note the sizes are basically irrelevant. And not included in the "cached" number from things like "free" anyway.

There have been some fixes for slab/slub allocators since that kernel level, but you really don't have a problem as the posters above indicated.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux memory management: Real memory or Cached buffers? gubbu Linux - Server 2 10-01-2010 01:58 AM
Memory staying in cached status kaplan71 Red Hat 1 10-25-2006 08:58 AM
Memory Dump for cached passwords SpinningCone Linux - Security 5 07-12-2006 09:27 AM
Increasing the amount of cached memory balteo Linux - General 1 09-16-2005 04:06 PM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration