Skip to content

Commit 63d027a

Browse files
Robin Holtgregkh
authored andcommitted
driver core: Convert link_mem_sections to use find_memory_block_hinted.
Modify link_mem_sections() to pass in the previous mem_block as a hint to locating the next mem_block. Since they are typically added in order this results in a massive saving in time during boot of a very large system. For example, on a 16TB x86_64 machine, it reduced the total time spent linking all node's memory sections from 1 hour, 27 minutes to 46 seconds. Signed-off-by: Robin Holt <holt@sgi.com> To: Gary Hade <garyhade@us.ibm.com> To: Badari Pulavarty <pbadari@us.ibm.com> To: Ingo Molnar <mingo@elte.hu> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9838303 commit 63d027a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/base/node.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,25 +409,27 @@ static int link_mem_sections(int nid)
409409
unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn;
410410
unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages;
411411
unsigned long pfn;
412+
struct memory_block *mem_blk = NULL;
412413
int err = 0;
413414

414415
for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
415416
unsigned long section_nr = pfn_to_section_nr(pfn);
416417
struct mem_section *mem_sect;
417-
struct memory_block *mem_blk;
418418
int ret;
419419

420420
if (!present_section_nr(section_nr))
421421
continue;
422422
mem_sect = __nr_to_section(section_nr);
423-
mem_blk = find_memory_block(mem_sect);
423+
mem_blk = find_memory_block_hinted(mem_sect, mem_blk);
424424
ret = register_mem_sect_under_node(mem_blk, nid);
425425
if (!err)
426426
err = ret;
427427

428428
/* discard ref obtained in find_memory_block() */
429-
kobject_put(&mem_blk->sysdev.kobj);
430429
}
430+
431+
if (mem_blk)
432+
kobject_put(&mem_blk->sysdev.kobj);
431433
return err;
432434
}
433435

0 commit comments

Comments
 (0)