内存管理-初始化代码

Posted doordie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了内存管理-初始化代码相关的知识,希望对你有一定的参考价值。

build_all_zonelists

该函数在系统初始化阶段建立每个node下的zonelist结构

 

void build_all_zonelists(void)
{
	set_zonelist_order();

	if (system_state == SYSTEM_BOOTING) {
		__build_all_zonelists(NULL);
		mminit_verify_zonelist();
		cpuset_init_current_mems_allowed();
	} else {
		/* we have to stop all cpus to guarantee there is no user
		   of zonelist */
		stop_machine(__build_all_zonelists, NULL, NULL);
		/* cpuset refresh routine should be here */
	}
	vm_total_pages = nr_free_pagecache_pages();
	/*
	 * Disable grouping by mobility if the number of pages in the
	 * system is too low to allow the mechanism to work. It would be
	 * more accurate, but expensive to check per-zone. This check is
	 * made on memory-hotadd so a system can start with mobility
	 * disabled and enable it later
	 */
	if (vm_total_pages < (pageblock_nr_pages * MIGRATE_TYPES))
		page_group_by_mobility_disabled = 1;
	else
		page_group_by_mobility_disabled = 0;

	printk("Built %i zonelists in %s order, mobility grouping %s.  "
		"Total pages: %ld
",
			nr_online_nodes,
			zonelist_order_name[current_zonelist_order],
			page_group_by_mobility_disabled ? "off" : "on",
			vm_total_pages);
#ifdef CONFIG_NUMA
	printk("Policy zone: %s
", zone_names[policy_zone]);
#endif
}

  

--------------------------------------------------------------------------------------------------

TODO1:default_zonelist_order,build_all_zonelists

以上是关于内存管理-初始化代码的主要内容,如果未能解决你的问题,请参考以下文章

内存管理

C 中的共享内存代码片段

如何使用模块化代码片段中的LeakCanary检测内存泄漏?

C/C++ 内存管理总结

linux 内存管理

linux内存管理