Re: [PATCH v2 5/5] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jia,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20180323]
[cannot apply to v4.16-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jia-He/optimize-memblock_next_valid_pfn-and-early_pfn_valid/20180325-175026
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x013-201812 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   mm/page_alloc.c: In function 'memmap_init_zone':
>> mm/page_alloc.c:5499:4: error: continue statement not within a loop
       continue;
       ^~~~~~~~
>> mm/page_alloc.c:5501:4: error: break statement not within loop or switch
       break;
       ^~~~~
   mm/page_alloc.c:5520:5: error: continue statement not within a loop
        continue;
        ^~~~~~~~
   mm/page_alloc.c:5462:6: warning: unused variable 'idx' [-Wunused-variable]
     int idx = -1;
         ^~~
   mm/page_alloc.c: At top level:
>> mm/page_alloc.c:5551:1: error: expected identifier or '(' before '}' token
    }
    ^

vim +5499 mm/page_alloc.c

^1da177e4 Linus Torvalds 2005-04-16  5468  
22b31eec6 Hugh Dickins   2009-01-06  5469  	if (highest_memmap_pfn < end_pfn - 1)
22b31eec6 Hugh Dickins   2009-01-06  5470  		highest_memmap_pfn = end_pfn - 1;
22b31eec6 Hugh Dickins   2009-01-06  5471  
4b94ffdc4 Dan Williams   2016-01-15  5472  	/*
4b94ffdc4 Dan Williams   2016-01-15  5473  	 * Honor reservation requested by the driver for this ZONE_DEVICE
4b94ffdc4 Dan Williams   2016-01-15  5474  	 * memory
4b94ffdc4 Dan Williams   2016-01-15  5475  	 */
4b94ffdc4 Dan Williams   2016-01-15  5476  	if (altmap && start_pfn == altmap->base_pfn)
4b94ffdc4 Dan Williams   2016-01-15  5477  		start_pfn += altmap->reserve;
4b94ffdc4 Dan Williams   2016-01-15  5478  
cbe8dd4af Greg Ungerer   2006-01-12  5479  	for (pfn = start_pfn; pfn < end_pfn; pfn++) {
a2f3aa025 Dave Hansen    2007-01-10  5480  		/*
b72d0ffb5 Andrew Morton  2016-03-15  5481  		 * There can be holes in boot-time mem_map[]s handed to this
b72d0ffb5 Andrew Morton  2016-03-15  5482  		 * function.  They do not exist on hotplugged memory.
a2f3aa025 Dave Hansen    2007-01-10  5483  		 */
b72d0ffb5 Andrew Morton  2016-03-15  5484  		if (context != MEMMAP_EARLY)
b72d0ffb5 Andrew Morton  2016-03-15  5485  			goto not_early;
b72d0ffb5 Andrew Morton  2016-03-15  5486  
c0b211780 Jia He         2018-03-24  5487  #if (defined CONFIG_HAVE_MEMBLOCK) && (defined CONFIG_HAVE_ARCH_PFN_VALID)
94200be7f Jia He         2018-03-24  5488  		if (!early_pfn_valid(pfn, &idx)) {
c0b211780 Jia He         2018-03-24  5489  			/*
c0b211780 Jia He         2018-03-24  5490  			 * Skip to the pfn preceding the next valid one (or
c0b211780 Jia He         2018-03-24  5491  			 * end_pfn), such that we hit a valid pfn (or end_pfn)
c0b211780 Jia He         2018-03-24  5492  			 * on our next iteration of the loop.
c0b211780 Jia He         2018-03-24  5493  			 */
5ce6c7e68 Jia He         2018-03-24  5494  			pfn = memblock_next_valid_pfn(pfn, &idx) - 1;
c0b211780 Jia He         2018-03-24  5495  #endif
d41dee369 Andy Whitcroft 2005-06-23  5496  			continue;
c0b211780 Jia He         2018-03-24  5497  		}
751679573 Andy Whitcroft 2006-10-21  5498  		if (!early_pfn_in_nid(pfn, nid))
751679573 Andy Whitcroft 2006-10-21 @5499  			continue;
b72d0ffb5 Andrew Morton  2016-03-15  5500  		if (!update_defer_init(pgdat, pfn, end_pfn, &nr_initialised))
3a80a7fa7 Mel Gorman     2015-06-30 @5501  			break;
342332e6a Taku Izumi     2016-03-15  5502  
342332e6a Taku Izumi     2016-03-15  5503  #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
342332e6a Taku Izumi     2016-03-15  5504  		/*
b72d0ffb5 Andrew Morton  2016-03-15  5505  		 * Check given memblock attribute by firmware which can affect
b72d0ffb5 Andrew Morton  2016-03-15  5506  		 * kernel memory layout.  If zone==ZONE_MOVABLE but memory is
b72d0ffb5 Andrew Morton  2016-03-15  5507  		 * mirrored, it's an overlapped memmap init. skip it.
342332e6a Taku Izumi     2016-03-15  5508  		 */
342332e6a Taku Izumi     2016-03-15  5509  		if (mirrored_kernelcore && zone == ZONE_MOVABLE) {
b72d0ffb5 Andrew Morton  2016-03-15  5510  			if (!r || pfn >= memblock_region_memory_end_pfn(r)) {
342332e6a Taku Izumi     2016-03-15  5511  				for_each_memblock(memory, tmp)
342332e6a Taku Izumi     2016-03-15  5512  					if (pfn < memblock_region_memory_end_pfn(tmp))
342332e6a Taku Izumi     2016-03-15  5513  						break;
342332e6a Taku Izumi     2016-03-15  5514  				r = tmp;
342332e6a Taku Izumi     2016-03-15  5515  			}
342332e6a Taku Izumi     2016-03-15  5516  			if (pfn >= memblock_region_memory_base_pfn(r) &&
342332e6a Taku Izumi     2016-03-15  5517  			    memblock_is_mirror(r)) {
342332e6a Taku Izumi     2016-03-15  5518  				/* already initialized as NORMAL */
342332e6a Taku Izumi     2016-03-15  5519  				pfn = memblock_region_memory_end_pfn(r);
342332e6a Taku Izumi     2016-03-15 @5520  				continue;
342332e6a Taku Izumi     2016-03-15  5521  			}
342332e6a Taku Izumi     2016-03-15  5522  		}
342332e6a Taku Izumi     2016-03-15  5523  #endif
ac5d2539b Mel Gorman     2015-06-30  5524  
b72d0ffb5 Andrew Morton  2016-03-15  5525  not_early:
d08f92e7d Pavel Tatashin 2018-03-23  5526  		page = pfn_to_page(pfn);
d08f92e7d Pavel Tatashin 2018-03-23  5527  		__init_single_page(page, pfn, zone, nid);
d08f92e7d Pavel Tatashin 2018-03-23  5528  		if (context == MEMMAP_HOTPLUG)
d08f92e7d Pavel Tatashin 2018-03-23  5529  			SetPageReserved(page);
d08f92e7d Pavel Tatashin 2018-03-23  5530  
ac5d2539b Mel Gorman     2015-06-30  5531  		/*
ac5d2539b Mel Gorman     2015-06-30  5532  		 * Mark the block movable so that blocks are reserved for
ac5d2539b Mel Gorman     2015-06-30  5533  		 * movable at startup. This will force kernel allocations
ac5d2539b Mel Gorman     2015-06-30  5534  		 * to reserve their blocks rather than leaking throughout
ac5d2539b Mel Gorman     2015-06-30  5535  		 * the address space during boot when many long-lived
974a786e6 Mel Gorman     2015-11-06  5536  		 * kernel allocations are made.
ac5d2539b Mel Gorman     2015-06-30  5537  		 *
ac5d2539b Mel Gorman     2015-06-30  5538  		 * bitmap is created for zone's valid pfn range. but memmap
ac5d2539b Mel Gorman     2015-06-30  5539  		 * can be created for invalid pages (for alignment)
ac5d2539b Mel Gorman     2015-06-30  5540  		 * check here not to call set_pageblock_migratetype() against
ac5d2539b Mel Gorman     2015-06-30  5541  		 * pfn out of zone.
9bb5a391f Michal Hocko   2018-01-31  5542  		 *
9bb5a391f Michal Hocko   2018-01-31  5543  		 * Please note that MEMMAP_HOTPLUG path doesn't clear memmap
9bb5a391f Michal Hocko   2018-01-31  5544  		 * because this is done early in sparse_add_one_section
ac5d2539b Mel Gorman     2015-06-30  5545  		 */
ac5d2539b Mel Gorman     2015-06-30  5546  		if (!(pfn & (pageblock_nr_pages - 1))) {
ac5d2539b Mel Gorman     2015-06-30  5547  			set_pageblock_migratetype(page, MIGRATE_MOVABLE);
9b6e63cbf Michal Hocko   2017-10-03  5548  			cond_resched();
^1da177e4 Linus Torvalds 2005-04-16  5549  		}
^1da177e4 Linus Torvalds 2005-04-16  5550  	}
ac5d2539b Mel Gorman     2015-06-30 @5551  }
^1da177e4 Linus Torvalds 2005-04-16  5552  

:::::: The code at line 5499 was first introduced by commit
:::::: 7516795739bd53175629b90fab0ad488d7a6a9f7 [PATCH] Reintroduce NODES_SPAN_OTHER_NODES for powerpc

:::::: TO: Andy Whitcroft <apw@xxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux