Thanks to you guys, I am now getting a grip on the sparsemem code. While going through the code, I came across several instances of the following: #ifndef CONFIG_NEED_MULTIPLE_NODES . <some code> . #endif Now, it seems like this configuration option is used in case there are multiple nodes in a system. But its linked/depends on NUMA/discontigmem. It could be possible that we have multiple nodes in a UMA system. How can sparsemem handle such cases ?? Regards, Naren On Wed, Jul 7, 2010 at 9:19 AM, Minchan Kim <minchan.kim@xxxxxxxxx> wrote: > On Tue, Jul 6, 2010 at 7:48 PM, <naren.mehra@xxxxxxxxx> wrote: >> Thanks Kame for your elaborate response, I got a lot of pointers on >> where to look for in the code. >> Kim, thanks for pointing out memmap_init_zone. >> So basically those sections which contains holes in them, the mem_map >> in those sections skip the entry for the invalid pages (holes). >> This happens in memmap_init_zone(). >> 1) So it means that all the sections get the initial allocation of >> mem_map and in memmap_init_zone we decide whether or not it requires > > Yes. kernel allocates memmap for non-empty sections. > Even kernel allocates memmap for section which has mixed with valid > and invalid(ex, hole) pages. For example, bank supports 64M but system > have 16M. Let's assume section size is 64M. In this case, section has > hole of 48M. > >> any mem_map entry. Correct ?? > > No. memmap_init_zone doesn't care about it. > Regardless of hole, it initializes page descriptors(include struct > page which on hole). > But page descriptors on holes are _Reserved_ then doesn't go to the > buddy allocator as free page. For it, free_bootmem_node marks 0x0 on > bitmap about only _valid_ pages by bank. Afterwards, > free_all_bootmem_core doesn't insert pages on hole into buddy by using > bitmap. Even memmap on hole would be free on ARM by > free_unused_memmap_node. > >> >> 2) Both of you mentioned that >>> "If a section contains both of valid pages and >>> holes, the section itself is marked as SECTION_MARKED_PRESENT." >>> "It just mark _bank_ which has memory with SECTION_MARKED_PRESENT. >>> Otherwise, Hole." >> >> which happens in memory_present(). In memory_present() code, I am not >> able to find anything where we are doing this classification of valid >> section/bank ? To me it looks that memory_present marks, all the >> sections as present and doesnt verify whether any section contains any >> valid pages or not. Correct ?? > > memory_present is just called on banks. > So some sections which consists of hole don't marked "SECTION_MARKED_PRESENT". > > I hope this help you. > > -- > Kind regards, > Minchan Kim > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href