mm/failslab.c:19:5: error: redefinition of 'should_failslab'

From: kernel test robot
Date: Wed Oct 02 2024 - 10:10:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e32cde8d2bd7d251a8f9b434143977ddf13dcec6
commit: 6ce2082fd3a25d5a8c756120959237cace0379f1 fault-inject: improve build for CONFIG_FAULT_INJECTION=n
date: 4 weeks ago
config: x86_64-randconfig-r133-20240215 (https://download.01.org/0day-ci/archive/20241002/202410022126.z1ggl2C9-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241002/202410022126.z1ggl2C9-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410022126.z1ggl2C9-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

mm/failslab.c:14:17: error: 'FAULT_ATTR_INITIALIZER' undeclared here (not in a function)
14 | .attr = FAULT_ATTR_INITIALIZER,
| ^~~~~~~~~~~~~~~~~~~~~~
>> mm/failslab.c:19:5: error: redefinition of 'should_failslab'
19 | int should_failslab(struct kmem_cache *s, gfp_t gfpflags)
| ^~~~~~~~~~~~~~~
In file included from mm/failslab.c:2:
include/linux/fault-inject.h:128:19: note: previous definition of 'should_failslab' with type 'int(struct kmem_cache *, gfp_t)' {aka 'int(struct kmem_cache *, unsigned int)'}
128 | static inline int should_failslab(struct kmem_cache *s, gfp_t gfpflags)
| ^~~~~~~~~~~~~~~
mm/failslab.c: In function 'should_failslab':
mm/failslab.c:44:26: error: 'FAULT_NOWARN' undeclared (first use in this function)
44 | flags |= FAULT_NOWARN;
| ^~~~~~~~~~~~
mm/failslab.c:44:26: note: each undeclared identifier is reported only once for each function it appears in


vim +/should_failslab +19 mm/failslab.c

773ff60e841461c Akinobu Mita 2008-12-23 8
773ff60e841461c Akinobu Mita 2008-12-23 9 static struct {
773ff60e841461c Akinobu Mita 2008-12-23 10 struct fault_attr attr;
71baba4b92dc1fa Mel Gorman 2015-11-06 11 bool ignore_gfp_reclaim;
621a5f7ad9cd1ce Viresh Kumar 2015-09-26 12 bool cache_filter;
773ff60e841461c Akinobu Mita 2008-12-23 13 } failslab = {
773ff60e841461c Akinobu Mita 2008-12-23 @14 .attr = FAULT_ATTR_INITIALIZER,
71baba4b92dc1fa Mel Gorman 2015-11-06 15 .ignore_gfp_reclaim = true,
621a5f7ad9cd1ce Viresh Kumar 2015-09-26 16 .cache_filter = false,
773ff60e841461c Akinobu Mita 2008-12-23 17 };
773ff60e841461c Akinobu Mita 2008-12-23 18
a7526fe8b94eced Vlastimil Babka 2024-07-11 @19 int should_failslab(struct kmem_cache *s, gfp_t gfpflags)
773ff60e841461c Akinobu Mita 2008-12-23 20 {
ea4452de2ae9873 Qi Zheng 2022-11-18 21 int flags = 0;
ea4452de2ae9873 Qi Zheng 2022-11-18 22
fab9963a69dbd71 Jesper Dangaard Brouer 2016-03-15 23 /* No fault-injection for bootstrap cache */
fab9963a69dbd71 Jesper Dangaard Brouer 2016-03-15 24 if (unlikely(s == kmem_cache))
a7526fe8b94eced Vlastimil Babka 2024-07-11 25 return 0;
fab9963a69dbd71 Jesper Dangaard Brouer 2016-03-15 26
773ff60e841461c Akinobu Mita 2008-12-23 27 if (gfpflags & __GFP_NOFAIL)
a7526fe8b94eced Vlastimil Babka 2024-07-11 28 return 0;
773ff60e841461c Akinobu Mita 2008-12-23 29
a9659476d4b391a Nicolas Boichat 2019-07-11 30 if (failslab.ignore_gfp_reclaim &&
a9659476d4b391a Nicolas Boichat 2019-07-11 31 (gfpflags & __GFP_DIRECT_RECLAIM))
a7526fe8b94eced Vlastimil Babka 2024-07-11 32 return 0;
773ff60e841461c Akinobu Mita 2008-12-23 33
fab9963a69dbd71 Jesper Dangaard Brouer 2016-03-15 34 if (failslab.cache_filter && !(s->flags & SLAB_FAILSLAB))
a7526fe8b94eced Vlastimil Babka 2024-07-11 35 return 0;
4c13dd3b48fcb6f Dmitry Monakhov 2010-02-26 36
ea4452de2ae9873 Qi Zheng 2022-11-18 37 /*
ea4452de2ae9873 Qi Zheng 2022-11-18 38 * In some cases, it expects to specify __GFP_NOWARN
ea4452de2ae9873 Qi Zheng 2022-11-18 39 * to avoid printing any information(not just a warning),
ea4452de2ae9873 Qi Zheng 2022-11-18 40 * thus avoiding deadlocks. See commit 6b9dbedbe349 for
ea4452de2ae9873 Qi Zheng 2022-11-18 41 * details.
ea4452de2ae9873 Qi Zheng 2022-11-18 42 */
3f913fc5f974561 Qi Zheng 2022-05-19 43 if (gfpflags & __GFP_NOWARN)
ea4452de2ae9873 Qi Zheng 2022-11-18 44 flags |= FAULT_NOWARN;
3f913fc5f974561 Qi Zheng 2022-05-19 45
a7526fe8b94eced Vlastimil Babka 2024-07-11 46 return should_fail_ex(&failslab.attr, s->object_size, flags) ? -ENOMEM : 0;
773ff60e841461c Akinobu Mita 2008-12-23 47 }
a7526fe8b94eced Vlastimil Babka 2024-07-11 48 ALLOW_ERROR_INJECTION(should_failslab, ERRNO);
773ff60e841461c Akinobu Mita 2008-12-23 49

:::::: The code at line 19 was first introduced by commit
:::::: a7526fe8b94eced7d82aa00b2bcca44e39ae0769 mm, slab: put should_failslab() back behind CONFIG_SHOULD_FAILSLAB

:::::: TO: Vlastimil Babka <vbabka@xxxxxxx>
:::::: CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki