shrink_active_list
来源:互联网 发布:dc数据恢复指南针 编辑:程序博客网 时间:2024/05/01 00:20
static void shrink_active_list(unsignedlong nr_to_scan, struct lruvec *lruvec, struct scan_control *sc, enum lru_list lru)
{
unsignedlong nr_taken;
unsignedlong nr_scanned;
unsignedlong vm_flags;
LIST_HEAD(l_hold); /* The pages which were snipped off */
LIST_HEAD(l_active);
LIST_HEAD(l_inactive);
structpage *page;
structzone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
unsignedlong nr_rotated = 0;
isolate_mode_tisolate_mode = 0;
int file = is_file_lru(lru);
structzone *zone = lruvec_zone(lruvec);
lru_add_drain();
if (!sc->may_unmap)
isolate_mode|= ISOLATE_UNMAPPED;
if (!sc->may_writepage)
isolate_mode|= ISOLATE_CLEAN;
spin_lock_irq(&zone->lru_lock);
nr_taken = isolate_lru_pages(nr_to_scan, lruvec,&l_hold, &nr_scanned, sc, isolate_mode, lru);
update_lru_size(lruvec, lru, -nr_taken);
__mod_zone_page_state(zone,NR_ISOLATED_ANON + file, nr_taken);
reclaim_stat->recent_scanned[file] +=nr_taken;
if (global_reclaim(sc))
__mod_zone_page_state(zone,NR_PAGES_SCANNED, nr_scanned);
__count_zone_vm_events(PGREFILL,zone, nr_scanned);
spin_unlock_irq(&zone->lru_lock);
while (!list_empty(&l_hold)) {
cond_resched();
page= lru_to_page(&l_hold);
list_del(&page->lru);
if(unlikely(!page_evictable(page))) {
putback_lru_page(page);
continue;
}
if(unlikely(buffer_heads_over_limit)) {
if(page_has_private(page) && trylock_page(page)) {
if(page_has_private(page))
try_to_release_page(page, 0);
unlock_page(page);
}
}
if (page_referenced(page, 0,sc->target_mem_cgroup,&vm_flags)) {
nr_rotated+= hpage_nr_pages(page);
if((vm_flags & VM_EXEC) && page_is_file_cache(page)) {
list_add(&page->lru,&l_active);
continue;
}
}
ClearPageActive(page); /* we are de-activating */
list_add(&page->lru,&l_inactive);
}
spin_lock_irq(&zone->lru_lock);
reclaim_stat->recent_rotated[file] +=nr_rotated;
move_active_pages_to_lru(lruvec,&l_active, &l_hold, lru);
move_active_pages_to_lru(lruvec,&l_inactive, &l_hold, lru - LRU_ACTIVE);
__mod_zone_page_state(zone,NR_ISOLATED_ANON + file, -nr_taken);
spin_unlock_irq(&zone->lru_lock);
mem_cgroup_uncharge_list(&l_hold);
free_hot_cold_page_list(&l_hold,true);
}
- shrink_active_list
- java系列笔记---异常
- 学习spring cloud第一课(微服务架构概述)
- SpringMVC Ajax请求返回404
- Git学习笔记01_创建版本库
- FTP基础知识 FTP port(主动模式) pasv(被动模式) 及如何映射FTP
- shrink_active_list
- Linux关于磁盘管理的二三事(二)
- dubbo源码分析
- 【bzoj1697】牛排序 置换群
- Codeforces Round #394 (Div. 2) E. Dasha and Puzzle 构造 坐标离散化
- 周笔记(6/52) - DX11 - Geometry Shader/Compute Shader
- 动脑学院Android高级开发视频教程
- nmap识别端口的6中状态
- IO流_字符缓冲输出流BufferedWriter的使用