From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [RFC v2 PATCH 2/3] mm: replace custom PG2KB/KB2PG macros with common ones
Date: Mon, 20 Sep 2021 01:13:42 +0800 [thread overview]
Message-ID: <202109200134.vB3xmC9c-lkp@intel.com> (raw)
In-Reply-To: <20210919131248.489798-3-oleksandr@natalenko.name>
[-- Attachment #1: Type: text/plain, Size: 41398 bytes --]
Hi Oleksandr,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on hnaz-mm/master]
url: https://github.com/0day-ci/linux/commits/Oleksandr-Natalenko/mm-common-PAGE_SIZE-shift-macros/20210919-211421
base: https://github.com/hnaz/linux-mm master
config: arc-randconfig-r014-20210919 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/c129ed106a8dd29030e8585cb39a779de91aaa6a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oleksandr-Natalenko/mm-common-PAGE_SIZE-shift-macros/20210919-211421
git checkout c129ed106a8dd29030e8585cb39a779de91aaa6a
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc prepare
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
arch/arc/Makefile:26: ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '' is unknown, fallback to ''
error: no override and no default toolchain set
init/Kconfig:70:warning: 'RUSTC_VERSION': number is invalid
In file included from ./arch/arc/include/generated/asm/div64.h:1,
from include/linux/math.h:5,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/preempt.h:11,
from include/linux/percpu.h:6,
from include/linux/arch_topology.h:9,
from include/linux/topology.h:30,
from include/linux/gfp.h:9,
from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/math64.h: In function 'div_u64_rem':
>> include/asm-generic/div64.h:224:13: error: implicit declaration of function 'is_power_of_2' [-Werror=implicit-function-declaration]
224 | is_power_of_2(__base)) { \
| ^~~~~~~~~~~~~
include/linux/math64.h:92:22: note: in expansion of macro 'do_div'
92 | *remainder = do_div(dividend, divisor);
| ^~~~~~
>> include/asm-generic/div64.h:226:25: error: implicit declaration of function 'ilog2' [-Werror=implicit-function-declaration]
226 | (n) >>= ilog2(__base); \
| ^~~~~
include/linux/math64.h:92:22: note: in expansion of macro 'do_div'
92 | *remainder = do_div(dividend, divisor);
| ^~~~~~
In file included from include/asm-generic/preempt.h:5,
from ./arch/arc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/arch_topology.h:9,
from include/linux/topology.h:30,
from include/linux/gfp.h:9,
from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/thread_info.h: In function 'set_ti_thread_flag':
>> include/linux/thread_info.h:89:9: error: implicit declaration of function 'set_bit' [-Werror=implicit-function-declaration]
89 | set_bit(flag, (unsigned long *)&ti->flags);
| ^~~~~~~
include/linux/thread_info.h: In function 'clear_ti_thread_flag':
>> include/linux/thread_info.h:94:9: error: implicit declaration of function 'clear_bit' [-Werror=implicit-function-declaration]
94 | clear_bit(flag, (unsigned long *)&ti->flags);
| ^~~~~~~~~
include/linux/thread_info.h: In function 'test_and_set_ti_thread_flag':
>> include/linux/thread_info.h:108:16: error: implicit declaration of function 'test_and_set_bit' [-Werror=implicit-function-declaration]
108 | return test_and_set_bit(flag, (unsigned long *)&ti->flags);
| ^~~~~~~~~~~~~~~~
include/linux/thread_info.h: In function 'test_and_clear_ti_thread_flag':
>> include/linux/thread_info.h:113:16: error: implicit declaration of function 'test_and_clear_bit' [-Werror=implicit-function-declaration]
113 | return test_and_clear_bit(flag, (unsigned long *)&ti->flags);
| ^~~~~~~~~~~~~~~~~~
include/linux/thread_info.h: In function 'test_ti_thread_flag':
>> include/linux/thread_info.h:118:16: error: implicit declaration of function 'test_bit'; did you mean 'test_taint'? [-Werror=implicit-function-declaration]
118 | return test_bit(flag, (unsigned long *)&ti->flags);
| ^~~~~~~~
| test_taint
In file included from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/percpu.h:7,
from include/linux/arch_topology.h:9,
from include/linux/topology.h:30,
from include/linux/gfp.h:9,
from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/bitmap.h: In function 'bitmap_empty':
>> include/linux/bitmap.h:391:16: error: implicit declaration of function 'find_first_bit'; did you mean 'sched_find_first_bit'? [-Werror=implicit-function-declaration]
391 | return find_first_bit(src, nbits) == nbits;
| ^~~~~~~~~~~~~~
| sched_find_first_bit
include/linux/bitmap.h: In function 'bitmap_full':
>> include/linux/bitmap.h:399:16: error: implicit declaration of function 'find_first_zero_bit' [-Werror=implicit-function-declaration]
399 | return find_first_zero_bit(src, nbits) == nbits;
| ^~~~~~~~~~~~~~~~~~~
include/linux/bitmap.h: In function 'bitmap_weight':
>> include/linux/bitmap.h:405:24: error: implicit declaration of function 'hweight_long' [-Werror=implicit-function-declaration]
405 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
| ^~~~~~~~~~~~
include/linux/bitmap.h: In function 'bitmap_set':
>> include/linux/bitmap.h:413:17: error: implicit declaration of function '__set_bit' [-Werror=implicit-function-declaration]
413 | __set_bit(start, map);
| ^~~~~~~~~
include/linux/bitmap.h: In function 'bitmap_clear':
>> include/linux/bitmap.h:427:17: error: implicit declaration of function '__clear_bit' [-Werror=implicit-function-declaration]
427 | __clear_bit(start, map);
| ^~~~~~~~~~~
include/linux/bitmap.h: In function 'bitmap_next_clear_region':
>> include/linux/bitmap.h:471:15: error: implicit declaration of function 'find_next_zero_bit' [-Werror=implicit-function-declaration]
471 | *rs = find_next_zero_bit(bitmap, end, *rs);
| ^~~~~~~~~~~~~~~~~~
>> include/linux/bitmap.h:472:15: error: implicit declaration of function 'find_next_bit' [-Werror=implicit-function-declaration]
472 | *re = find_next_bit(bitmap, end, *rs + 1);
| ^~~~~~~~~~~~~
In file included from include/linux/smp.h:13,
from include/linux/percpu.h:7,
from include/linux/arch_topology.h:9,
from include/linux/topology.h:30,
from include/linux/gfp.h:9,
from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/cpumask.h: In function 'cpumask_last':
>> include/linux/cpumask.h:206:16: error: implicit declaration of function 'find_last_bit' [-Werror=implicit-function-declaration]
206 | return find_last_bit(cpumask_bits(srcp), nr_cpumask_bits);
| ^~~~~~~~~~~~~
include/linux/cpumask.h: In function 'num_online_cpus':
>> include/linux/cpumask.h:887:16: error: implicit declaration of function 'atomic_read' [-Werror=implicit-function-declaration]
887 | return atomic_read(&__num_online_cpus);
| ^~~~~~~~~~~
In file included from include/linux/smp_types.h:5,
from include/linux/smp.h:15,
from include/linux/percpu.h:7,
from include/linux/arch_topology.h:9,
from include/linux/topology.h:30,
from include/linux/gfp.h:9,
from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/llist.h: In function 'llist_del_all':
>> include/linux/llist.h:237:16: error: implicit declaration of function 'xchg' [-Werror=implicit-function-declaration]
237 | return xchg(&head->first, NULL);
| ^~~~
>> include/linux/llist.h:237:16: warning: returning 'int' from a function with return type 'struct llist_node *' makes pointer from integer without a cast [-Wint-conversion]
237 | return xchg(&head->first, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from <command-line>:
include/linux/gfp.h: In function 'gfp_migratetype':
>> include/linux/gfp.h:347:63: error: 'MIGRATE_MOVABLE' undeclared (first use in this function)
347 | BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
| ^~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
302 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
322 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/gfp.h:347:9: note: in expansion of macro 'BUILD_BUG_ON'
347 | BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
| ^~~~~~~~~~~~
include/linux/gfp.h:347:63: note: each undeclared identifier is reported only once for each function it appears in
347 | BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
| ^~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
302 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
322 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/gfp.h:347:9: note: in expansion of macro 'BUILD_BUG_ON'
347 | BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
| ^~~~~~~~~~~~
In file included from include/asm-generic/bug.h:5,
from arch/arc/include/asm/bug.h:30,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
>> include/linux/gfp.h:349:22: error: 'page_group_by_mobility_disabled' undeclared (first use in this function)
349 | if (unlikely(page_group_by_mobility_disabled))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
In file included from include/linux/mm.h:10,
from arch/arc/include/asm/arcregs.h:149,
from arch/arc/include/asm/irqflags-compact.h:16,
from arch/arc/include/asm/irqflags.h:11,
from include/linux/irqflags.h:16,
from arch/arc/include/asm/smp.h:102,
from arch/arc/include/asm/cmpxchg.h:13,
from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:188,
from include/linux/bitops.h:33,
from include/linux/log2.h:12,
from kernel/bounds.c:13:
include/linux/gfp.h:350:24: error: 'MIGRATE_UNMOVABLE' undeclared (first use in this function)
350 | return MIGRATE_UNMOVABLE;
| ^~~~~~~~~~~~~~~~~
include/linux/gfp.h: At top level:
include/linux/gfp.h:441:25: warning: "ZONES_SHIFT" is not defined, evaluates to 0 [-Wundef]
441 | #define GFP_ZONES_SHIFT ZONES_SHIFT
| ^~~~~~~~~~~
include/linux/gfp.h:444:10: note: in expansion of macro 'GFP_ZONES_SHIFT'
444 | #if 16 * GFP_ZONES_SHIFT > BITS_PER_LONG
| ^~~~~~~~~~~~~~~
include/linux/gfp.h: In function 'gfp_zone':
include/linux/gfp.h:441:25: error: 'ZONES_SHIFT' undeclared (first use in this function); did you mean 'NMI_SHIFT'?
441 | #define GFP_ZONES_SHIFT ZONES_SHIFT
| ^~~~~~~~~~~
include/linux/gfp.h:449:29: note: in expansion of macro 'GFP_ZONES_SHIFT'
449 | (ZONE_NORMAL << 0 * GFP_ZONES_SHIFT) \
| ^~~~~~~~~~~~~~~
include/linux/gfp.h:481:14: note: in expansion of macro 'GFP_ZONE_TABLE'
481 | z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
| ^~~~~~~~~~~~~~
include/linux/gfp.h: In function 'gfp_zonelist':
include/linux/gfp.h:500:16: error: 'ZONELIST_FALLBACK' undeclared (first use in this function)
500 | return ZONELIST_FALLBACK;
| ^~~~~~~~~~~~~~~~~
include/linux/gfp.h: In function 'node_zonelist':
include/linux/gfp.h:514:16: error: implicit declaration of function 'NODE_DATA' [-Werror=implicit-function-declaration]
514 | return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
| ^~~~~~~~~
include/linux/gfp.h:514:30: error: invalid type argument of '->' (have 'int')
514 | return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
| ^~
include/linux/gfp.h: At top level:
include/linux/gfp.h:525:17: error: unknown type name 'nodemask_t'
525 | nodemask_t *nodemask);
| ^~~~~~~~~~
include/linux/gfp.h:527:17: error: unknown type name 'nodemask_t'
527 | nodemask_t *nodemask);
| ^~~~~~~~~~
include/linux/gfp.h:530:33: error: unknown type name 'nodemask_t'
530 | nodemask_t *nodemask, int nr_pages,
| ^~~~~~~~~~
include/linux/gfp.h: In function 'alloc_pages_bulk_list':
include/linux/gfp.h:538:16: error: implicit declaration of function '__alloc_pages_bulk'; did you mean 'alloc_pages_bulk_list'? [-Werror=implicit-function-declaration]
538 | return __alloc_pages_bulk(gfp, numa_mem_id(), NULL, nr_pages, list, NULL);
| ^~~~~~~~~~~~~~~~~~
| alloc_pages_bulk_list
include/linux/gfp.h: In function 'alloc_pages_bulk_array_node':
include/linux/gfp.h:550:20: error: 'NUMA_NO_NODE' undeclared (first use in this function)
550 | if (nid == NUMA_NO_NODE)
| ^~~~~~~~~~~~
In file included from include/asm-generic/bug.h:5,
from arch/arc/include/asm/bug.h:30,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/gfp.h: In function '__alloc_pages_node':
include/linux/gfp.h:563:37: error: 'MAX_NUMNODES' undeclared (first use in this function)
563 | VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
| ^~~~~~~~~~~~
include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/mmdebug.h:17:25: note: in expansion of macro 'BUG_ON'
17 | #define VM_BUG_ON(cond) BUG_ON(cond)
| ^~~~~~
include/linux/gfp.h:563:9: note: in expansion of macro 'VM_BUG_ON'
563 | VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
| ^~~~~~~~~
In file included from arch/arc/include/asm/bug.h:30,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/gfp.h:564:52: error: implicit declaration of function 'node_online'; did you mean 'node_zonelist'? [-Werror=implicit-function-declaration]
564 | VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid));
| ^~~~~~~~~~~
include/asm-generic/bug.h:121:32: note: in definition of macro 'WARN_ON'
121 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
include/linux/gfp.h:564:9: note: in expansion of macro 'VM_WARN_ON'
564 | VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid));
| ^~~~~~~~~~
vim +/MIGRATE_MOVABLE +347 include/linux/gfp.h
6cb062296f73e747 Christoph Lameter 2007-10-16 342
01c0bfe061f309b8 Wei Yang 2020-06-03 343 static inline int gfp_migratetype(const gfp_t gfp_flags)
467c996c1e191063 Mel Gorman 2007-10-16 344 {
016c13daa5c9e482 Mel Gorman 2015-11-06 345 VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
016c13daa5c9e482 Mel Gorman 2015-11-06 346 BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE);
016c13daa5c9e482 Mel Gorman 2015-11-06 @347 BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
467c996c1e191063 Mel Gorman 2007-10-16 348
467c996c1e191063 Mel Gorman 2007-10-16 @349 if (unlikely(page_group_by_mobility_disabled))
467c996c1e191063 Mel Gorman 2007-10-16 @350 return MIGRATE_UNMOVABLE;
467c996c1e191063 Mel Gorman 2007-10-16 351
467c996c1e191063 Mel Gorman 2007-10-16 352 /* Group based on mobility */
016c13daa5c9e482 Mel Gorman 2015-11-06 353 return (gfp_flags & GFP_MOVABLE_MASK) >> GFP_MOVABLE_SHIFT;
467c996c1e191063 Mel Gorman 2007-10-16 354 }
dd56b046426760aa Mel Gorman 2015-11-06 355 #undef GFP_MOVABLE_MASK
dd56b046426760aa Mel Gorman 2015-11-06 356 #undef GFP_MOVABLE_SHIFT
a2f1b424900715ed Andi Kleen 2005-11-05 357
d0164adc89f6bb37 Mel Gorman 2015-11-06 358 static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
d0164adc89f6bb37 Mel Gorman 2015-11-06 359 {
543dfb2df8ebb3eb Joshua Clayton 2016-01-14 360 return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
d0164adc89f6bb37 Mel Gorman 2015-11-06 361 }
d0164adc89f6bb37 Mel Gorman 2015-11-06 362
20eb4f29b60286e0 Tejun Heo 2019-10-24 363 /**
20eb4f29b60286e0 Tejun Heo 2019-10-24 364 * gfpflags_normal_context - is gfp_flags a normal sleepable context?
20eb4f29b60286e0 Tejun Heo 2019-10-24 365 * @gfp_flags: gfp_flags to test
20eb4f29b60286e0 Tejun Heo 2019-10-24 366 *
20eb4f29b60286e0 Tejun Heo 2019-10-24 367 * Test whether @gfp_flags indicates that the allocation is from the
20eb4f29b60286e0 Tejun Heo 2019-10-24 368 * %current context and allowed to sleep.
20eb4f29b60286e0 Tejun Heo 2019-10-24 369 *
20eb4f29b60286e0 Tejun Heo 2019-10-24 370 * An allocation being allowed to block doesn't mean it owns the %current
20eb4f29b60286e0 Tejun Heo 2019-10-24 371 * context. When direct reclaim path tries to allocate memory, the
20eb4f29b60286e0 Tejun Heo 2019-10-24 372 * allocation context is nested inside whatever %current was doing at the
20eb4f29b60286e0 Tejun Heo 2019-10-24 373 * time of the original allocation. The nested allocation may be allowed
20eb4f29b60286e0 Tejun Heo 2019-10-24 374 * to block but modifying anything %current owns can corrupt the outer
20eb4f29b60286e0 Tejun Heo 2019-10-24 375 * context's expectations.
20eb4f29b60286e0 Tejun Heo 2019-10-24 376 *
20eb4f29b60286e0 Tejun Heo 2019-10-24 377 * %true result from this function indicates that the allocation context
20eb4f29b60286e0 Tejun Heo 2019-10-24 378 * can sleep and use anything that's associated with %current.
20eb4f29b60286e0 Tejun Heo 2019-10-24 379 */
20eb4f29b60286e0 Tejun Heo 2019-10-24 380 static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
20eb4f29b60286e0 Tejun Heo 2019-10-24 381 {
20eb4f29b60286e0 Tejun Heo 2019-10-24 382 return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) ==
20eb4f29b60286e0 Tejun Heo 2019-10-24 383 __GFP_DIRECT_RECLAIM;
20eb4f29b60286e0 Tejun Heo 2019-10-24 384 }
20eb4f29b60286e0 Tejun Heo 2019-10-24 385
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 386 #ifdef CONFIG_HIGHMEM
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 387 #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 388 #else
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 389 #define OPT_ZONE_HIGHMEM ZONE_NORMAL
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 390 #endif
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 391
4b51d66989218aad Christoph Lameter 2007-02-10 392 #ifdef CONFIG_ZONE_DMA
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 393 #define OPT_ZONE_DMA ZONE_DMA
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 394 #else
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 395 #define OPT_ZONE_DMA ZONE_NORMAL
4b51d66989218aad Christoph Lameter 2007-02-10 396 #endif
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 397
4e4785bcf0c85032 Christoph Lameter 2006-09-25 398 #ifdef CONFIG_ZONE_DMA32
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 399 #define OPT_ZONE_DMA32 ZONE_DMA32
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 400 #else
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 401 #define OPT_ZONE_DMA32 ZONE_NORMAL
4e4785bcf0c85032 Christoph Lameter 2006-09-25 402 #endif
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 403
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 404 /*
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 405 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
ac2e8e40acf4c73e Hao Lee 2017-05-03 406 * zone to use given the lowest 4 bits of gfp_t. Entries are GFP_ZONES_SHIFT
ac2e8e40acf4c73e Hao Lee 2017-05-03 407 * bits long and there are 16 of them to cover all possible combinations of
263ff5d8e82e5772 matt mooney 2010-05-24 408 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM.
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 409 *
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 410 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 411 * But GFP_MOVABLE is not only a zone specifier but also an allocation
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 412 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
263ff5d8e82e5772 matt mooney 2010-05-24 413 * Only 1 bit of the lowest 3 bits (DMA,DMA32,HIGHMEM) can be set to "1".
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 414 *
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 415 * bit result
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 416 * =================
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 417 * 0x0 => NORMAL
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 418 * 0x1 => DMA or NORMAL
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 419 * 0x2 => HIGHMEM or NORMAL
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 420 * 0x3 => BAD (DMA+HIGHMEM)
4b33b6959581d509 Huaisheng Ye 2018-06-07 421 * 0x4 => DMA32 or NORMAL
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 422 * 0x5 => BAD (DMA+DMA32)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 423 * 0x6 => BAD (HIGHMEM+DMA32)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 424 * 0x7 => BAD (HIGHMEM+DMA32+DMA)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 425 * 0x8 => NORMAL (MOVABLE+0)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 426 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 427 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 428 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
4b33b6959581d509 Huaisheng Ye 2018-06-07 429 * 0xc => DMA32 or NORMAL (MOVABLE+DMA32)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 430 * 0xd => BAD (MOVABLE+DMA32+DMA)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 431 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 432 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 433 *
b11a7b94100cba5e Dan Williams 2016-03-17 434 * GFP_ZONES_SHIFT must be <= 2 on 32 bit platforms.
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 435 */
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 436
b11a7b94100cba5e Dan Williams 2016-03-17 437 #if defined(CONFIG_ZONE_DEVICE) && (MAX_NR_ZONES-1) <= 4
b11a7b94100cba5e Dan Williams 2016-03-17 438 /* ZONE_DEVICE is not a valid GFP zone specifier */
b11a7b94100cba5e Dan Williams 2016-03-17 439 #define GFP_ZONES_SHIFT 2
b11a7b94100cba5e Dan Williams 2016-03-17 440 #else
b11a7b94100cba5e Dan Williams 2016-03-17 @441 #define GFP_ZONES_SHIFT ZONES_SHIFT
b11a7b94100cba5e Dan Williams 2016-03-17 442 #endif
b11a7b94100cba5e Dan Williams 2016-03-17 443
b11a7b94100cba5e Dan Williams 2016-03-17 444 #if 16 * GFP_ZONES_SHIFT > BITS_PER_LONG
b11a7b94100cba5e Dan Williams 2016-03-17 445 #error GFP_ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 446 #endif
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 447
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 448 #define GFP_ZONE_TABLE ( \
b11a7b94100cba5e Dan Williams 2016-03-17 449 (ZONE_NORMAL << 0 * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 450 | (OPT_ZONE_DMA << ___GFP_DMA * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 451 | (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 452 | (OPT_ZONE_DMA32 << ___GFP_DMA32 * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 453 | (ZONE_NORMAL << ___GFP_MOVABLE * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 454 | (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * GFP_ZONES_SHIFT) \
b11a7b94100cba5e Dan Williams 2016-03-17 455 | (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * GFP_ZONES_SHIFT)\
b11a7b94100cba5e Dan Williams 2016-03-17 456 | (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * GFP_ZONES_SHIFT)\
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 457 )
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 458
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 459 /*
263ff5d8e82e5772 matt mooney 2010-05-24 460 * GFP_ZONE_BAD is a bitmap for all combinations of __GFP_DMA, __GFP_DMA32
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 461 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 462 * entry starting with bit 0. Bit is set if the combination is not
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 463 * allowed.
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 464 */
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 465 #define GFP_ZONE_BAD ( \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 466 1 << (___GFP_DMA | ___GFP_HIGHMEM) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 467 | 1 << (___GFP_DMA | ___GFP_DMA32) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 468 | 1 << (___GFP_DMA32 | ___GFP_HIGHMEM) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 469 | 1 << (___GFP_DMA | ___GFP_DMA32 | ___GFP_HIGHMEM) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 470 | 1 << (___GFP_MOVABLE | ___GFP_HIGHMEM | ___GFP_DMA) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 471 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_DMA) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 472 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_HIGHMEM) \
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 473 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_DMA | ___GFP_HIGHMEM) \
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 474 )
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 475
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 476 static inline enum zone_type gfp_zone(gfp_t flags)
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 477 {
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 478 enum zone_type z;
16b56cf4b8a0fa9a Namhyung Kim 2010-10-26 479 int bit = (__force int) (flags & GFP_ZONEMASK);
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 480
b11a7b94100cba5e Dan Williams 2016-03-17 481 z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
b11a7b94100cba5e Dan Williams 2016-03-17 482 ((1 << GFP_ZONES_SHIFT) - 1);
82d4b5779a758877 Dave Hansen 2011-05-24 483 VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
b70d94ee438b3fd9 Christoph Lameter 2009-06-16 484 return z;
4e4785bcf0c85032 Christoph Lameter 2006-09-25 485 }
4e4785bcf0c85032 Christoph Lameter 2006-09-25 486
^1da177e4c3f4152 Linus Torvalds 2005-04-16 487 /*
^1da177e4c3f4152 Linus Torvalds 2005-04-16 488 * There is only one page-allocator function, and two main namespaces to
^1da177e4c3f4152 Linus Torvalds 2005-04-16 489 * it. The alloc_page*() variants return 'struct page *' and as such
^1da177e4c3f4152 Linus Torvalds 2005-04-16 490 * can allocate highmem pages, the *get*page*() variants return
^1da177e4c3f4152 Linus Torvalds 2005-04-16 491 * virtual kernel addresses to the allocated page(s).
^1da177e4c3f4152 Linus Torvalds 2005-04-16 492 */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 493
54a6eb5c4765aa57 Mel Gorman 2008-04-28 494 static inline int gfp_zonelist(gfp_t flags)
54a6eb5c4765aa57 Mel Gorman 2008-04-28 495 {
c00eb15a8914b8ba Yaowei Bai 2016-01-14 496 #ifdef CONFIG_NUMA
c00eb15a8914b8ba Yaowei Bai 2016-01-14 497 if (unlikely(flags & __GFP_THISNODE))
c00eb15a8914b8ba Yaowei Bai 2016-01-14 498 return ZONELIST_NOFALLBACK;
c00eb15a8914b8ba Yaowei Bai 2016-01-14 499 #endif
c00eb15a8914b8ba Yaowei Bai 2016-01-14 @500 return ZONELIST_FALLBACK;
54a6eb5c4765aa57 Mel Gorman 2008-04-28 501 }
54a6eb5c4765aa57 Mel Gorman 2008-04-28 502
^1da177e4c3f4152 Linus Torvalds 2005-04-16 503 /*
^1da177e4c3f4152 Linus Torvalds 2005-04-16 504 * We get the zone list from the current node and the gfp_mask.
cb152a1a95606aad Shijie Luo 2021-05-06 505 * This zone list contains a maximum of MAX_NUMNODES*MAX_NR_ZONES zones.
54a6eb5c4765aa57 Mel Gorman 2008-04-28 506 * There are two zonelists per node, one for all zones with memory and
54a6eb5c4765aa57 Mel Gorman 2008-04-28 507 * one containing just zones from the node the zonelist belongs to.
^1da177e4c3f4152 Linus Torvalds 2005-04-16 508 *
d3c251ab95b69f3d Mike Rapoport 2021-06-28 509 * For the case of non-NUMA systems the NODE_DATA() gets optimized to
d3c251ab95b69f3d Mike Rapoport 2021-06-28 510 * &contig_page_data at compile-time.
^1da177e4c3f4152 Linus Torvalds 2005-04-16 511 */
0e88460da6ab7bb6 Mel Gorman 2008-04-28 512 static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
0e88460da6ab7bb6 Mel Gorman 2008-04-28 513 {
54a6eb5c4765aa57 Mel Gorman 2008-04-28 @514 return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
0e88460da6ab7bb6 Mel Gorman 2008-04-28 515 }
^1da177e4c3f4152 Linus Torvalds 2005-04-16 516
^1da177e4c3f4152 Linus Torvalds 2005-04-16 517 #ifndef HAVE_ARCH_FREE_PAGE
^1da177e4c3f4152 Linus Torvalds 2005-04-16 518 static inline void arch_free_page(struct page *page, int order) { }
^1da177e4c3f4152 Linus Torvalds 2005-04-16 519 #endif
cc102509074bba03 Nicholas Piggin 2006-12-06 520 #ifndef HAVE_ARCH_ALLOC_PAGE
cc102509074bba03 Nicholas Piggin 2006-12-06 521 static inline void arch_alloc_page(struct page *page, int order) { }
cc102509074bba03 Nicholas Piggin 2006-12-06 522 #endif
^1da177e4c3f4152 Linus Torvalds 2005-04-16 523
84172f4bb7524244 Matthew Wilcox (Oracle 2021-04-29 524) struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
04ec6264f28793e5 Vlastimil Babka 2017-07-06 @525 nodemask_t *nodemask);
da90006b76b64857 Andrew Morton 2021-09-16 526 struct folio *__folio_alloc(gfp_t gfp, unsigned int order, int preferred_nid,
da90006b76b64857 Andrew Morton 2021-09-16 527 nodemask_t *nodemask);
e4048e5dc4aecec6 KOSAKI Motohiro 2008-07-23 528
387ba26fb1cb9be9 Mel Gorman 2021-04-29 529 unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
387ba26fb1cb9be9 Mel Gorman 2021-04-29 530 nodemask_t *nodemask, int nr_pages,
0f87d9d30f21390d Mel Gorman 2021-04-29 531 struct list_head *page_list,
0f87d9d30f21390d Mel Gorman 2021-04-29 532 struct page **page_array);
387ba26fb1cb9be9 Mel Gorman 2021-04-29 533
387ba26fb1cb9be9 Mel Gorman 2021-04-29 534 /* Bulk allocate order-0 pages */
387ba26fb1cb9be9 Mel Gorman 2021-04-29 535 static inline unsigned long
0f87d9d30f21390d Mel Gorman 2021-04-29 536 alloc_pages_bulk_list(gfp_t gfp, unsigned long nr_pages, struct list_head *list)
387ba26fb1cb9be9 Mel Gorman 2021-04-29 537 {
0f87d9d30f21390d Mel Gorman 2021-04-29 @538 return __alloc_pages_bulk(gfp, numa_mem_id(), NULL, nr_pages, list, NULL);
0f87d9d30f21390d Mel Gorman 2021-04-29 539 }
0f87d9d30f21390d Mel Gorman 2021-04-29 540
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25909 bytes --]
next prev parent reply other threads:[~2021-09-19 17:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-19 13:12 [RFC v2 PATCH 0/3] mm: common PAGE_SIZE shift macros Oleksandr Natalenko
2021-09-19 13:12 ` [RFC v2 PATCH 1/3] mm: add PG2KB/KB2PG helper macros Oleksandr Natalenko
2021-09-19 13:21 ` Greg Kroah-Hartman
2021-09-19 14:21 ` Matthew Wilcox
2021-09-19 13:12 ` [RFC v2 PATCH 2/3] mm: replace custom PG2KB/KB2PG macros with common ones Oleksandr Natalenko
2021-09-19 15:35 ` kernel test robot
2021-09-19 17:13 ` kernel test robot [this message]
2021-09-19 13:12 ` [RFC v2 PATCH 3/3] mm: replace open-coded PG2KB/KB2PG variants with macros Oleksandr Natalenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202109200134.vB3xmC9c-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.