On Sat, 14 Jun 2008 10:51:19 +0800 "Peter Teoh" <htmldeveloper@xxxxxxxxx> wrote: > first, it should attempt to allocate space from physical mem...and it > uses max_pfn as the mark to guide it. No. > On the other hand, because i cannot find the link between max_pfn and > __get_free_pages() - so question is how does __get_free_pages() know > where the max pfn it can used for memory allocation? You read correctly, __get_free_pages() has absolutely nothing to do with max_pfn. > next, it should then update the pagetable entries - right?\ No, __get_free_pages() never manipulates page tables. > essentially...it should be marking the pagetable entries for the block > of memory as "notfree" - right? what is the function used? thanks. This info is not kept in page tables, but in the array struct page mem_map[]. Take a look at the functions that __get_free_pages() calls: alloc_pages() -> alloc_pages_node() -> __alloc_pages() -> __alloc_pages_internal() -> get_page_from_freelist() -> buffered_rmqueue() -> rmqueue_bulk() -> __rmqueue() -> __rmqueue_smallest() As you can see, each zone has a number of free lists, for each allocation order: /* Find a page of the appropriate size in the preferred list */ for (current_order = order; current_order < MAX_ORDER; ++current_order) { area = &(zone->free_area[current_order]); if (list_empty(&area->free_list[migratetype])) continue; page = list_entry(area->free_list[migratetype].next, struct page, lru); -- All rights reversed. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ