慢慢欣赏linux 页面回收

int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, unsigned long address, enum ttu_flags flags)
	struct mm_struct *mm = vma->vm_mm;
	pte_t *pte = page_check_address(page, mm, address, &ptl, 0);
	
	flush_cache_page(vma, address, page_to_pfn(page));
	pteval = ptep_clear_flush_notify(vma, address, pte);//tlb
	
	if (pte_dirty(pteval))
		set_page_dirty(page);

	page_remove_rmap(page);
	page_cache_release(page);//释放页框
unsigned long try_to_free_pages(struct zonelist *zonelist, int order, gfp_t gfp_mask, nodemask_t *nodemask)
	struct scan_control sc = {
		.gfp_mask = gfp_mask,
		.may_writepage = !laptop_mode,
		.nr_to_reclaim = SWAP_CLUSTER_MAX,
		.may_unmap = 1,
		.may_swap = 1,
		.swappiness = vm_swappiness,
		.order = order,
		.mem_cgroup = NULL,
		.isolate_pages = isolate_pages_global,
		.nodemask = nodemask,
	};

	return do_try_to_free_pages(zonelist, &sc);
	=>unsigned long do_try_to_free_pages(struct zonelist *zonelist, struct scan_control *sc)
		for (priority = DEF_PRIORITY; priority >= 0; priority--)
			shrink_zones(priority, zonelist, sc);
			=>void shrink_zones(int priority, struct zonelist *zonelist, struct scan_control *sc)
				for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx, sc->nodemask)
					shrink_zone(priority, zone, sc);
					=>void shrink_zone(int priority, struct zone *zone, struct scan_control *sc)
						while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || nr[LRU_INACTIVE_FILE])
							for_each_evictable_lru(l)
								if (nr[l])
									nr_to_scan = min_t(unsigned long, nr[l], SWAP_CLUSTER_MAX);
									nr[l] -= nr_to_scan;
		
									nr_reclaimed += shrink_list(l, nr_to_scan, zone, sc, priority);
									=>unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, struct zone *zone, struct scan_control *sc, int priority)
										int file = is_file_lru(lru);
										if (is_active_lru(lru))
											if (inactive_list_is_low(zone, sc, file))
												shrink_active_list(nr_to_scan, zone, sc, priority, file);
											return 0;
											
										return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
										=>unsigned long shrink_inactive_list(unsigned long max_scan, struct zone *zone, struct scan_control *sc, int priority, int file)
											nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);

Linux页面回收与反向映射机制
http://www.233.com/linux/fudao/20110324/153235403-4.html

Linux内存管理之页面回收
https://blog.csdn.net/wh8_2011/article/details/52275231

【内核】Linux 2.6 内存反向映射机制 Reverse Mapping
https://www.cnblogs.com/visayafan/archive/2011/12/24/2300758.html

linux 逆向映射机制浅析
https://www.cnblogs.com/ck1020/p/6883061.html

郭健:Linux内存管理系统参数配置之overcommit
https://blog.csdn.net/jus3ve/article/details/80681655

页面回收---LRU链表
https://blog.csdn.net/zouxiaoting/article/details/8824896

直接内存回收中的等待队列   好文章
http://www.cnblogs.com/tolimit/p/5481419.html

Linux内核设计与实现(16)--页高速缓存和页回写
http://blog.chinaunix.net/uid-24708340-id-4060950.html

Linux Kernel文件系统写I/O流程代码分析(二)bdi_writeback
https://www.cnblogs.com/jimbo17/p/10491223.html

read()/write()的生命旅程之四——第四章:writeback
http://blog.sina.com.cn/s/blog_a558c25a0102vhv3.html

block_prepare_write
https://blog.csdn.net/kidd_3/article/details/7032785

基数树(radix tree)
https://www.cnblogs.com/wuchanming/p/3824990.html

linux内核之把块放在页高速缓存中
http://blog.chinaunix.net/uid-28977986-id-3778156.html

内存脏数据下刷(linux2.6.18/linux.2.6.32)剖析
https://blog.csdn.net/u011013137/article/details/9110967

Linux内核进程详解之二:bdi-default
http://www.lenky.info/archives/2012/02/1125

Linux内存管理 —— 文件系统缓存和匿名页的交换
https://blog.csdn.net/jasonchen_gbd/article/details/79462014

内存管理---匿名页面管理
https://blog.csdn.net/jasonlee_lijiaqi/article/details/83068446

Linux 匿名页的反向映射
https://www.cnblogs.com/linhaostudy/p/10350326.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值