mm/page_alloc.c:984:9: warning: iteration 119304648 invokes undefined behavior

From: kernel test robot
Date: Thu May 19 2022 - 17:16:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b015dcd62b86d298829990f8261d5d154b8d7af5
commit: 44042b4498728f4376e84bae1ac8016d146d850b mm/page_alloc: allow high-order pages to be stored on the per-cpu lists
date: 11 months ago
config: powerpc-randconfig-r002-20220519 (https://download.01.org/0day-ci/archive/20220520/202205200521.65W2rpLt-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 11.3.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=44042b4498728f4376e84bae1ac8016d146d850b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 44042b4498728f4376e84bae1ac8016d146d850b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

mm/page_alloc.c:3823:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes]
3823 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
| ^~~~~~~~~~~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:6471: Error: unrecognized opcode: `wrteei'
{standard input}:6700: Error: unrecognized opcode: `wrtee'
mm/page_alloc.c: In function 'rmqueue.isra':
>> mm/page_alloc.c:984:9: warning: iteration 119304648 invokes undefined behavior [-Waggressive-loop-optimizations]
984 | list_add(&page->lru, &area->free_list[migratetype]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/page_alloc.c:2305:21: note: within this loop
2305 | while (high > low) {
| ~~~~~^~~~~
{standard input}:9878: Error: unrecognized opcode: `wrteei'
{standard input}:10902: Error: unrecognized opcode: `wrtee'
{standard input}:11103: Error: unrecognized opcode: `wrteei'
{standard input}:11321: Error: unrecognized opcode: `wrtee'
{standard input}:12224: Error: unrecognized opcode: `wrteei'
{standard input}:12816: Error: unrecognized opcode: `wrtee'
{standard input}:12822: Error: unrecognized opcode: `wrteei'
{standard input}:12831: Error: unrecognized opcode: `wrtee'
{standard input}:14310: Error: unrecognized opcode: `wrteei'
{standard input}:14402: Error: unrecognized opcode: `wrteei'
{standard input}:14431: Error: unrecognized opcode: `wrteei'
{standard input}:14476: Error: unrecognized opcode: `wrtee'
{standard input}:14484: Error: unrecognized opcode: `wrtee'
{standard input}:14503: Error: unrecognized opcode: `wrtee'
{standard input}:17180: Error: unrecognized opcode: `wrteei'
{standard input}:17816: Error: unrecognized opcode: `wrtee'
{standard input}:17828: Error: unrecognized opcode: `wrtee'


vim +984 mm/page_alloc.c

5e1f0f098b4649 Mel Gorman 2019-03-05 977
6ab0136310961e Alexander Duyck 2020-04-06 978 /* Used for pages not on another list */
6ab0136310961e Alexander Duyck 2020-04-06 979 static inline void add_to_free_list(struct page *page, struct zone *zone,
6ab0136310961e Alexander Duyck 2020-04-06 980 unsigned int order, int migratetype)
6ab0136310961e Alexander Duyck 2020-04-06 981 {
6ab0136310961e Alexander Duyck 2020-04-06 982 struct free_area *area = &zone->free_area[order];
6ab0136310961e Alexander Duyck 2020-04-06 983
6ab0136310961e Alexander Duyck 2020-04-06 @984 list_add(&page->lru, &area->free_list[migratetype]);
6ab0136310961e Alexander Duyck 2020-04-06 985 area->nr_free++;
6ab0136310961e Alexander Duyck 2020-04-06 986 }
6ab0136310961e Alexander Duyck 2020-04-06 987

:::::: The code at line 984 was first introduced by commit
:::::: 6ab0136310961ebf4b5ecb565f0bf52c233dc093 mm: use zone and order instead of free area in free_list manipulators

:::::: TO: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp