1, most of this article from: http://blog.csdn.net/vanbreaker/article/details/7611585
2, in Start_kernel ()-->paging_init ()-->zone_sizes_init ()-->free_area_init_nodes ()-->free_area_init_ Node ()-->free_area_init_core ()-->init_currently_empty_zone ()->zone_init_free_lists (), Free_ The related fields of area are initialized
[CPP]View Plaincopy
- static void __meminit zone_init_free_lists (struct zone *zone)
- {
- int order, t;
- For_each_migratetype_order (order, T) {
- / * list initialized to empty list * /
- Init_list_head (&zone->free_area[order].free_list[t]);
- / * Number of memory blocks initialized to 0*/
- Zone->free_area[order].nr_free = 0;
- }
- }
Start_kernel ()-->mm_init ()-->mem_init (), responsible for the statistics of all available low-end memory and high-end memory, and released into the partner system
In Free_area_init_core ()-->memmap_init () (-->memmap_init_zone ())-->set_pageblock_migratetype (), The bitmap-related area of the pageblock_flags representation in the struct zone corresponding to each Pageblock start Page box is marked as movable, which means that the pageblock is movable, that is, when the kernel initializes the partner system, All pages are marked as movable
The kernel first initializes some data items for the node and the management area through Setup_arch ()-->paging_init ()-->zone_sizes_init (), where the core function is Free_area_init_node (), Used to initialize for a specific node
At this point, the key data for the node and the management area has been initialized, and the kernel is prepared to do a good job of managing the memory in the future by chaining all the node's administrative areas into the zonelist, so that the kernel of the memory allocation work is Start_kernel ()-->build_all_ Initialization of Zonelist completed in Zonelist ()
[Linux Memory] Partner System Learning Note (ii)--memory system initialization