lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 30 May 2021 17:46:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Yang Shi <shy828301@...il.com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, Zi Yan <ziy@...dia.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: mm/migrate.c:1406:5: warning: stack frame size of 2096 bytes in
 function 'migrate_pages'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b90e90f40b4ff23c753126008bf4713a42353af6
commit: dd4ae78a21fc05d91d841e499dddd057ad64a4df mm: migrate: simplify the logic for handling permanent failure
date:   6 months ago
config: powerpc-randconfig-r034-20210530 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bc6799f2f79f0ae87e9f1ebf9d25ba799fbd25a9)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd4ae78a21fc05d91d841e499dddd057ad64a4df
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout dd4ae78a21fc05d91d841e499dddd057ad64a4df
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from mm/migrate.c:16:
   In file included from include/linux/migrate.h:5:
   In file included from include/linux/mm.h:9:
   In file included from include/linux/mmdebug.h:5:
   In file included from include/linux/bug.h:5:
   In file included from arch/powerpc/include/asm/bug.h:109:
   In file included from include/asm-generic/bug.h:20:
   In file included from include/linux/kernel.h:12:
   In file included from include/linux/bitops.h:29:
   In file included from arch/powerpc/include/asm/bitops.h:62:
   arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
   #define __lwsync()      __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
           ^
   <built-in>:309:9: note: previous definition is here
   #define __lwsync __builtin_ppc_lwsync
           ^
>> mm/migrate.c:1406:5: warning: stack frame size of 2096 bytes in function 'migrate_pages' [-Wframe-larger-than=]
   int migrate_pages(struct list_head *from, new_page_t get_new_page,
       ^
   2 warnings generated.


vim +/migrate_pages +1406 mm/migrate.c

290408d4a25002 Naoya Horiguchi         2010-09-08  1384  
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1385  /*
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1386   * migrate_pages - migrate the pages specified in a list, to the free pages
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1387   *		   supplied as the target for the page migration
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1388   *
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1389   * @from:		The list of pages to be migrated.
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1390   * @get_new_page:	The function used to allocate free pages to be used
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1391   *			as the target of the page migration.
68711a746345c4 David Rientjes          2014-06-04  1392   * @put_new_page:	The function used to free target pages if migration
68711a746345c4 David Rientjes          2014-06-04  1393   *			fails, or NULL if no special handling is necessary.
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1394   * @private:		Private data to be passed on to get_new_page()
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1395   * @mode:		The migration mode that specifies the constraints for
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1396   *			page migration, if any.
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1397   * @reason:		The reason for page migration.
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1398   *
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1399   * The function returns after 10 attempts or if no pages are movable any more
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1400   * because the list has become empty or no retryable pages exist any more.
dd4ae78a21fc05 Yang Shi                2020-12-14  1401   * It is caller's responsibility to call putback_movable_pages() to return pages
dd4ae78a21fc05 Yang Shi                2020-12-14  1402   * to the LRU or free list only if ret != 0.
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1403   *
c73e5c9c59a0f7 Srivatsa S. Bhat        2013-04-29  1404   * Returns the number of pages that were not migrated, or an error code.
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1405   */
9c620e2bc5aa42 Hugh Dickins            2013-02-22 @1406  int migrate_pages(struct list_head *from, new_page_t get_new_page,
68711a746345c4 David Rientjes          2014-06-04  1407  		free_page_t put_new_page, unsigned long private,
68711a746345c4 David Rientjes          2014-06-04  1408  		enum migrate_mode mode, int reason)
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1409  {
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1410  	int retry = 1;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1411  	int thp_retry = 1;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1412  	int nr_failed = 0;
5647bc293ab15f Mel Gorman              2012-10-19  1413  	int nr_succeeded = 0;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1414  	int nr_thp_succeeded = 0;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1415  	int nr_thp_failed = 0;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1416  	int nr_thp_split = 0;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1417  	int pass = 0;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1418  	bool is_thp = false;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1419  	struct page *page;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1420  	struct page *page2;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1421  	int swapwrite = current->flags & PF_SWAPWRITE;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1422  	int rc, nr_subpages;
dd4ae78a21fc05 Yang Shi                2020-12-14  1423  	LIST_HEAD(ret_pages);
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1424  
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1425  	if (!swapwrite)
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1426  		current->flags |= PF_SWAPWRITE;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1427  
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1428  	for (pass = 0; pass < 10 && (retry || thp_retry); pass++) {
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1429  		retry = 0;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1430  		thp_retry = 0;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1431  
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1432  		list_for_each_entry_safe(page, page2, from, lru) {
94723aafb9e764 Michal Hocko            2018-04-10  1433  retry:
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1434  			/*
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1435  			 * THP statistics is based on the source huge page.
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1436  			 * Capture required information that might get lost
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1437  			 * during migration.
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1438  			 */
6c5c7b9f335272 Zi Yan                  2020-09-25  1439  			is_thp = PageTransHuge(page) && !PageHuge(page);
6c357848b44b40 Matthew Wilcox (Oracle  2020-08-14  1440) 			nr_subpages = thp_nr_pages(page);
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1441  			cond_resched();
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1442  
31caf665e666b5 Naoya Horiguchi         2013-09-11  1443  			if (PageHuge(page))
31caf665e666b5 Naoya Horiguchi         2013-09-11  1444  				rc = unmap_and_move_huge_page(get_new_page,
68711a746345c4 David Rientjes          2014-06-04  1445  						put_new_page, private, page,
dd4ae78a21fc05 Yang Shi                2020-12-14  1446  						pass > 2, mode, reason,
dd4ae78a21fc05 Yang Shi                2020-12-14  1447  						&ret_pages);
31caf665e666b5 Naoya Horiguchi         2013-09-11  1448  			else
68711a746345c4 David Rientjes          2014-06-04  1449  				rc = unmap_and_move(get_new_page, put_new_page,
add05cecef803f Naoya Horiguchi         2015-06-24  1450  						private, page, pass > 2, mode,
dd4ae78a21fc05 Yang Shi                2020-12-14  1451  						reason, &ret_pages);
dd4ae78a21fc05 Yang Shi                2020-12-14  1452  			/*
dd4ae78a21fc05 Yang Shi                2020-12-14  1453  			 * The rules are:
dd4ae78a21fc05 Yang Shi                2020-12-14  1454  			 *	Success: non hugetlb page will be freed, hugetlb
dd4ae78a21fc05 Yang Shi                2020-12-14  1455  			 *		 page will be put back
dd4ae78a21fc05 Yang Shi                2020-12-14  1456  			 *	-EAGAIN: stay on the from list
dd4ae78a21fc05 Yang Shi                2020-12-14  1457  			 *	-ENOMEM: stay on the from list
dd4ae78a21fc05 Yang Shi                2020-12-14  1458  			 *	Other errno: put on ret_pages list then splice to
dd4ae78a21fc05 Yang Shi                2020-12-14  1459  			 *		     from list
dd4ae78a21fc05 Yang Shi                2020-12-14  1460  			 */
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1461  			switch(rc) {
95a402c3847cc1 Christoph Lameter       2006-06-23  1462  			case -ENOMEM:
94723aafb9e764 Michal Hocko            2018-04-10  1463  				/*
94723aafb9e764 Michal Hocko            2018-04-10  1464  				 * THP migration might be unsupported or the
94723aafb9e764 Michal Hocko            2018-04-10  1465  				 * allocation could've failed so we should
94723aafb9e764 Michal Hocko            2018-04-10  1466  				 * retry on the same page with the THP split
94723aafb9e764 Michal Hocko            2018-04-10  1467  				 * to base pages.
94723aafb9e764 Michal Hocko            2018-04-10  1468  				 *
94723aafb9e764 Michal Hocko            2018-04-10  1469  				 * Head page is retried immediately and tail
94723aafb9e764 Michal Hocko            2018-04-10  1470  				 * pages are added to the tail of the list so
94723aafb9e764 Michal Hocko            2018-04-10  1471  				 * we encounter them after the rest of the list
94723aafb9e764 Michal Hocko            2018-04-10  1472  				 * is processed.
94723aafb9e764 Michal Hocko            2018-04-10  1473  				 */
6c5c7b9f335272 Zi Yan                  2020-09-25  1474  				if (is_thp) {
94723aafb9e764 Michal Hocko            2018-04-10  1475  					lock_page(page);
94723aafb9e764 Michal Hocko            2018-04-10  1476  					rc = split_huge_page_to_list(page, from);
94723aafb9e764 Michal Hocko            2018-04-10  1477  					unlock_page(page);
94723aafb9e764 Michal Hocko            2018-04-10  1478  					if (!rc) {
94723aafb9e764 Michal Hocko            2018-04-10  1479  						list_safe_reset_next(page, page2, lru);
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1480  						nr_thp_split++;
94723aafb9e764 Michal Hocko            2018-04-10  1481  						goto retry;
94723aafb9e764 Michal Hocko            2018-04-10  1482  					}
6c5c7b9f335272 Zi Yan                  2020-09-25  1483  
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1484  					nr_thp_failed++;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1485  					nr_failed += nr_subpages;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1486  					goto out;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1487  				}
dfef2ef4027b13 David Rientjes          2016-05-20  1488  				nr_failed++;
95a402c3847cc1 Christoph Lameter       2006-06-23  1489  				goto out;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1490  			case -EAGAIN:
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1491  				if (is_thp) {
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1492  					thp_retry++;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1493  					break;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1494  				}
b20a35035f983f Christoph Lameter       2006-03-22  1495  				retry++;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1496  				break;
78bd52097d0420 Rafael Aquini           2012-12-11  1497  			case MIGRATEPAGE_SUCCESS:
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1498  				if (is_thp) {
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1499  					nr_thp_succeeded++;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1500  					nr_succeeded += nr_subpages;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1501  					break;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1502  				}
5647bc293ab15f Mel Gorman              2012-10-19  1503  				nr_succeeded++;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1504  				break;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1505  			default:
354a3363363724 Naoya Horiguchi         2014-01-21  1506  				/*
354a3363363724 Naoya Horiguchi         2014-01-21  1507  				 * Permanent failure (-EBUSY, -ENOSYS, etc.):
354a3363363724 Naoya Horiguchi         2014-01-21  1508  				 * unlike -EAGAIN case, the failed page is
354a3363363724 Naoya Horiguchi         2014-01-21  1509  				 * removed from migration page list and not
354a3363363724 Naoya Horiguchi         2014-01-21  1510  				 * retried in the next outer loop.
354a3363363724 Naoya Horiguchi         2014-01-21  1511  				 */
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1512  				if (is_thp) {
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1513  					nr_thp_failed++;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1514  					nr_failed += nr_subpages;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1515  					break;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1516  				}
b20a35035f983f Christoph Lameter       2006-03-22  1517  				nr_failed++;
e24f0b8f76cc3d Christoph Lameter       2006-06-23  1518  				break;
2d1db3b1170db4 Christoph Lameter       2006-06-23  1519  			}
b20a35035f983f Christoph Lameter       2006-03-22  1520  		}
b20a35035f983f Christoph Lameter       2006-03-22  1521  	}
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1522  	nr_failed += retry + thp_retry;
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1523  	nr_thp_failed += thp_retry;
f2f81fb2b72b83 Vlastimil Babka         2015-11-05  1524  	rc = nr_failed;
95a402c3847cc1 Christoph Lameter       2006-06-23  1525  out:
dd4ae78a21fc05 Yang Shi                2020-12-14  1526  	/*
dd4ae78a21fc05 Yang Shi                2020-12-14  1527  	 * Put the permanent failure page back to migration list, they
dd4ae78a21fc05 Yang Shi                2020-12-14  1528  	 * will be put back to the right list by the caller.
dd4ae78a21fc05 Yang Shi                2020-12-14  1529  	 */
dd4ae78a21fc05 Yang Shi                2020-12-14  1530  	list_splice(&ret_pages, from);
dd4ae78a21fc05 Yang Shi                2020-12-14  1531  
5647bc293ab15f Mel Gorman              2012-10-19  1532  	count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
5647bc293ab15f Mel Gorman              2012-10-19  1533  	count_vm_events(PGMIGRATE_FAIL, nr_failed);
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1534  	count_vm_events(THP_MIGRATION_SUCCESS, nr_thp_succeeded);
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1535  	count_vm_events(THP_MIGRATION_FAIL, nr_thp_failed);
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1536  	count_vm_events(THP_MIGRATION_SPLIT, nr_thp_split);
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1537  	trace_mm_migrate_pages(nr_succeeded, nr_failed, nr_thp_succeeded,
1a5bae25e3cf95 Anshuman Khandual       2020-08-11  1538  			       nr_thp_failed, nr_thp_split, mode, reason);
7b2a2d4a18fffa Mel Gorman              2012-10-19  1539  
b20a35035f983f Christoph Lameter       2006-03-22  1540  	if (!swapwrite)
b20a35035f983f Christoph Lameter       2006-03-22  1541  		current->flags &= ~PF_SWAPWRITE;
b20a35035f983f Christoph Lameter       2006-03-22  1542  
95a402c3847cc1 Christoph Lameter       2006-06-23  1543  	return rc;
b20a35035f983f Christoph Lameter       2006-03-22  1544  }
b20a35035f983f Christoph Lameter       2006-03-22  1545  

:::::: The code at line 1406 was first introduced by commit
:::::: 9c620e2bc5aa4256c102ada34e6c76204ed5898b mm: remove offlining arg to migrate_pages

:::::: TO: Hugh Dickins <hughd@...gle.com>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (31308 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ