Re: Buffer/page cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> As far I have understood the buffer cache is for buffering block
> devices  data and the page cache for buffering filesystems' file
data. 

Linux has no separate buffer cache, there is only a page cache. When
the block device layer needs a buffer to read in data, it gets a page
from
page cache and attaches a buffer head to it (see grow_buffers()). 

 Each time grow_buffers() gets a page, it increments a global 
buffermem_pages. What "free" reports as 'buffers' and 'cached'
is buffermem_pages and (page_cache_size - buffermem_pages).

> But when the  command "cat /dev/hda > /dev/null" runs, the "free"
>  command reports that  'cached' is growing and 'buffers' are
shrinking.
>  Can anyone figure out what  have I misunderstood?

 My guess is that block layer is freeing the buffers (i.e freeing
buffer heads
and decrementing the page usage count), but the page remains in page
cache - may be because it is still being referenced. Not a very
convincing
explanation, but that's all I can think of.

Hope this helps,
Ravi.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux