Re: [PATCH v2 2/2] mm/sparse: start using sparse_init_nid(), and remove old code
From: Baoquan He
Date: Sun Jul 01 2018 - 21:52:23 EST
On 07/01/18 at 09:46pm, Pavel Tatashin wrote:
> ~~~
> > Here, node id passed to sparse_init_nid() should be 'nid_begin', but not
> > 'nid'. When you found out the current section's 'nid' is diferent than
> > 'nid_begin', handle node 'nid_begin', then start to next node 'nid'.
>
> Thank you for reviewing this work. Here nid equals to nid_begin:
>
> See, "if" at 501, and this call is at 505.
Yes, if they are equal at 501, 'continue' to for loop. If nid is not
equal to nid_begin, we execute sparse_init_nid(), here should it be that
nid_begin is the current node, nid is next node?
>
> 492 void __init sparse_init(void)
> 493 {
> 494 unsigned long pnum_begin = first_present_section_nr();
> 495 int nid_begin = sparse_early_nid(__nr_to_section(pnum_begin));
> 496 unsigned long pnum_end, map_count = 1;
> 497
> 498 for_each_present_section_nr(pnum_begin + 1, pnum_end) {
> 499 int nid = sparse_early_nid(__nr_to_section(pnum_end));
> 500
> 501 if (nid == nid_begin) {
> 502 map_count++;
> 503 continue;
> 504 }
> 505 sparse_init_nid(nid, pnum_begin, pnum_end, map_count);
> 506 nid_begin = nid;
> 507 pnum_begin = pnum_end;
> 508 map_count = 1;
> 509 }
> 510 sparse_init_nid(nid_begin, pnum_begin, pnum_end, map_count);
> 511 vmemmap_populate_print_last();
> 512 }
>
> Thank you,
> Pavel