What does drop_caches do?

Mulyadi Santosa mulyadi.santosa at gmail.com
Wed Aug 24 01:25:56 EDT 2011


Hi.... :)

On Thu, Jul 28, 2011 at 13:58, Prateek Sharma <prateeks at cse.iitb.ac.in> wrote:
>        From my understanding of the code (fs/drop_caches.c) , it walks over all
> the open files/inodes, and invalidates all the mapped pages.

I doubt that would be open files/inodes..more likely list of pages.

>Pages which are
> *not* dropped are either dirty,in-use,

I quite agree with that....

>anonymous,

uhm..... they are not dropped...they are paged out AFAIK...

>mapped(to pagetable),
mapped, maybe.....if they are file backed...

>or
> writeback) .

you mean is still written out? then maybe yes...

>        But, when i run drop_caches, there are still some pages which show up as
> cached. Why arent all cache pages getting dropped ?

AFAIK there are few reasons: they are locked in RAM, allocated
strictly for kernel usage (loading kernel modules, kernel image
etc)....maybe more...

>        My confusion runs much deeper. What exactly constitutes the pagecache?

it caches the reading from device....to be precise, block
devices,either being read through VFS layer or directly from block
layer (we call it "raw access")

>If i copy a bunch of files, why does my
> cache get polluted with those pages?

because files content are put into page cache once it is read :)


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com



More information about the Kernelnewbies mailing list