What happened in UBIFS during drop cache?
2016-08-24 16:35
701 查看
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 will cause the kernel to drop clean caches, dentries and
inodes from memory, causing that 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 are not freeable, the
user should run `sync' first.
==============================================================
After echo N > /proc/sys/vm/drop_caches, kernel will call function drop_caches_sysctl_handler, this is the top interface to drop caches:
fs/drop_caches.c
drop_slab will call all the shrinkers to free memory, like ubifs_shrinker.
In ubifs_shinker, will free the znodes and tnc tree. Details please refer to ubifs_shrinker in fs/ubifs/shrinker.c.
Author: Marty
Date: 2016-8-24
The end.
Drop cache is part of sysctl, you can get the details from Documentation/sysctl/vm.txt as below:
drop_caches
Writing to this will cause the kernel to drop clean caches, dentries and
inodes from memory, causing that 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 are not freeable, the
user should run `sync' first.
==============================================================
After echo N > /proc/sys/vm/drop_caches, kernel will call function drop_caches_sysctl_handler, this is the top interface to drop caches:
int drop_caches_sysctl_handler(ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { int ret; ret = proc_dointvec_minmax(table, write, buffer, length, ppos); if (ret) return ret; if (write) { if (sysctl_drop_caches & 1) iterate_supers(drop_pagecache_sb, NULL); if (sysctl_drop_caches & 2) drop_slab(); } return 0; }
fs/drop_caches.c
drop_slab will call all the shrinkers to free memory, like ubifs_shrinker.
In ubifs_shinker, will free the znodes and tnc tree. Details please refer to ubifs_shrinker in fs/ubifs/shrinker.c.
Author: Marty
Date: 2016-8-24
The end.
相关文章推荐
- Ask DB Specialists: Bind Variable Peeking,Misses in library cache during parse
- SHOW OPEN TABLES – what is in your table cache
- What can we do in the CacheMetaData Method of Activity
- What do Java objects look like in memory during run-time?
- What do Java objects look like in memory during run-time?(未看)
- 如何清空buffers and cache in linux system
- What’s New in Swift 2
- How to skip other publishable projects during publish a clickonce project in a solution?
- whats most important in ur life?
- What happens when there is a cache miss?
- What's In A GIF - Bit by Byte
- What to test in localization?
- What To Tell Your Manager In Your Employee Performance Review
- Node.js async in practice: When to use what?
- What is the most important thing in your life?
- iOS 各版本中的新特性(What's New in iOS)- 目录翻译完成
- *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit
- What is Action in C#?
- GWA2-Java built-in cache /带连接池的缓存流程设计
- What does idl attribute mean in the W3C html5 standard document?