Managing the processors memory (Virtual and Physical) is a key component of the Linux Kernel that is intimately tied in to performance and scalability.
Processor physical memory is allocated by ZONEs. But how about its Address Space (struct address_space) ?
Atleast one place that the ADDRESS SPACE (struct address_space) is initialized is when the processors INODE (struct inode) is created (on open system calls, for example).
It is atleast at this time also that the flags of the ADDRESS SPACE is initialzed to indicate the ZONE in which the pages which belong to it will reside.
When it comes time for the allocation of a page, a page needs to be selected from the appropriate ZONE as indicated by the Address Space. Page flags are also initialized at INIT time to belong to the ZONE (free_area_init_core). This facilitates returning the page to the correct ZONE‘s free list when it is freed up (when a process terminates, for example).
I will blog on this at length. Please subscribe to our mail list for automated updates on new blog entries. I explain Linux Kernel concepts and more in my classes ( Advanced Linux Kernel Programming @UCSC-Extension, and also in other classes that I teach independently). As always, Feedback, Questions and Comments are appreciated and will be responded to.