What happened in UBIFS during drop cache?

Source: Internet
Author: User

Today I want to know what happend in UBIFS during drop cache.

Drop Cache is part of sysctl, you can get the details from Documentation/sysctl/vm.txt as below:

Drop_caches

Writing to this would cause the kernel to drop clean caches, dentries and
Inodes from memory, causing the memory to become free.

To free Pagecache:
Echo 1 >/proc/sys/vm/drop_caches
To free dentries and inodes:
Echo 2 >/proc/sys/vm/drop_caches
To free Pagecache, dentries and Inodes:
Echo 3 >/proc/sys/vm/drop_caches

As this is a non-destructive operation and dirty objects was not freeable, the
User should run ' sync ' first.

==============================================================

After echo N >/proc/sys/vm/drop_caches, kernel would call function Drop_caches_sysctl_handler, this is the top INTERFAC E to drop caches:

1 intDrop_caches_sysctl_handler (Ctl_table *table,intWrite,2     void__user *buffer, size_t *length, loff_t *PPOs)3 {4     intret;5 6RET =Proc_dointvec_minmax (table, write, buffer, length, ppos);7     if(ret)8         returnret;9     if(write) { Ten         if(Sysctl_drop_caches &1) One iterate_supers (DROP_PAGECACHE_SB, NULL); A         if(Sysctl_drop_caches &2) - Drop_slab (); -     }    the     return 0; -}
FS/DROP_CACHES.C

Drop_slab would call all of the shrinkers to free memory, like Ubifs_shrinker.

In Ubifs_shinker, would free the znodes and TNC tree. Details refer to Ubifs_shrinker in fs/ubifs/shrinker.c.

Author:marty

Date:2016-8-24

The end.

What happened in UBIFS during drop cache?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.