fs/btrfs/extent-tree.c:1983:21: warning: stack frame size of 1424 bytes in function '__btrfs_run_delayed_refs'

From: kernel test robot
Date: Sat May 08 2021 - 17:43:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b741596468b010af2846b75f5e75a842ce344a6e
commit: d25e37d89dd2f41d7acae0429039d2f0ae8b4a07 tracepoint: Optimize using static_call()
date: 8 months ago
config: powerpc64-randconfig-r023-20210509 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 1312852040b3190a6cb7d7c1f61fe95a5e930d8d)
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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64

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

All warnings (new ones prefixed by >>):

In file included from fs/btrfs/extent-tree.c:28:
fs/btrfs/sysfs.h:16:14: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
const char * const btrfs_feature_set_name(enum btrfs_feature_set set);
^~~~~~
>> fs/btrfs/extent-tree.c:1983:21: warning: stack frame size of 1424 bytes in function '__btrfs_run_delayed_refs' [-Wframe-larger-than=]
static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
^
2 warnings generated.


vim +/__btrfs_run_delayed_refs +1983 fs/btrfs/extent-tree.c

e726138676f896 Nikolay Borisov 2018-08-15 1978
79787eaab46121 Jeff Mahoney 2012-03-12 1979 /*
79787eaab46121 Jeff Mahoney 2012-03-12 1980 * Returns 0 on success or if called with an already aborted transaction.
79787eaab46121 Jeff Mahoney 2012-03-12 1981 * Returns -ENOMEM or -EIO on failure and will abort the transaction.
79787eaab46121 Jeff Mahoney 2012-03-12 1982 */
d7df2c796d7eed Josef Bacik 2014-01-23 @1983 static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
d7df2c796d7eed Josef Bacik 2014-01-23 1984 unsigned long nr)
56bec294dea971 Chris Mason 2009-03-13 1985 {
0a1e458a1e49dc Nikolay Borisov 2018-03-15 1986 struct btrfs_fs_info *fs_info = trans->fs_info;
56bec294dea971 Chris Mason 2009-03-13 1987 struct btrfs_delayed_ref_root *delayed_refs;
56bec294dea971 Chris Mason 2009-03-13 1988 struct btrfs_delayed_ref_head *locked_ref = NULL;
0a2b2a844af616 Josef Bacik 2014-01-23 1989 ktime_t start = ktime_get();
56bec294dea971 Chris Mason 2009-03-13 1990 int ret;
d7df2c796d7eed Josef Bacik 2014-01-23 1991 unsigned long count = 0;
0a2b2a844af616 Josef Bacik 2014-01-23 1992 unsigned long actual_count = 0;
56bec294dea971 Chris Mason 2009-03-13 1993
56bec294dea971 Chris Mason 2009-03-13 1994 delayed_refs = &trans->transaction->delayed_refs;
0110a4c4345153 Nikolay Borisov 2018-08-15 1995 do {
56bec294dea971 Chris Mason 2009-03-13 1996 if (!locked_ref) {
b1cdbcb53a6edd Nikolay Borisov 2018-08-15 1997 locked_ref = btrfs_obtain_ref_head(trans);
0110a4c4345153 Nikolay Borisov 2018-08-15 1998 if (IS_ERR_OR_NULL(locked_ref)) {
0110a4c4345153 Nikolay Borisov 2018-08-15 1999 if (PTR_ERR(locked_ref) == -EAGAIN) {
c3e69d58e86c39 Chris Mason 2009-03-13 2000 continue;
0110a4c4345153 Nikolay Borisov 2018-08-15 2001 } else {
0110a4c4345153 Nikolay Borisov 2018-08-15 2002 break;
56bec294dea971 Chris Mason 2009-03-13 2003 }
56bec294dea971 Chris Mason 2009-03-13 2004 }
0110a4c4345153 Nikolay Borisov 2018-08-15 2005 count++;
0110a4c4345153 Nikolay Borisov 2018-08-15 2006 }
2c3cf7d5f6105b Filipe Manana 2015-10-22 2007 /*
2c3cf7d5f6105b Filipe Manana 2015-10-22 2008 * We need to try and merge add/drops of the same ref since we
2c3cf7d5f6105b Filipe Manana 2015-10-22 2009 * can run into issues with relocate dropping the implicit ref
2c3cf7d5f6105b Filipe Manana 2015-10-22 2010 * and then it being added back again before the drop can
2c3cf7d5f6105b Filipe Manana 2015-10-22 2011 * finish. If we merged anything we need to re-loop so we can
2c3cf7d5f6105b Filipe Manana 2015-10-22 2012 * get a good ref.
2c3cf7d5f6105b Filipe Manana 2015-10-22 2013 * Or we can get node references of the same type that weren't
2c3cf7d5f6105b Filipe Manana 2015-10-22 2014 * merged when created due to bumps in the tree mod seq, and
2c3cf7d5f6105b Filipe Manana 2015-10-22 2015 * we need to merge them to prevent adding an inline extent
2c3cf7d5f6105b Filipe Manana 2015-10-22 2016 * backref before dropping it (triggering a BUG_ON at
2c3cf7d5f6105b Filipe Manana 2015-10-22 2017 * insert_inline_extent_backref()).
2c3cf7d5f6105b Filipe Manana 2015-10-22 2018 */
d7df2c796d7eed Josef Bacik 2014-01-23 2019 spin_lock(&locked_ref->lock);
be97f133b374bd Nikolay Borisov 2018-04-19 2020 btrfs_merge_delayed_refs(trans, delayed_refs, locked_ref);
ae1e206b806ccc Josef Bacik 2012-08-07 2021
0110a4c4345153 Nikolay Borisov 2018-08-15 2022 ret = btrfs_run_delayed_refs_for_head(trans, locked_ref,
0110a4c4345153 Nikolay Borisov 2018-08-15 2023 &actual_count);
0110a4c4345153 Nikolay Borisov 2018-08-15 2024 if (ret < 0 && ret != -EAGAIN) {
c1103f7a5d7a54 Josef Bacik 2017-09-29 2025 /*
0110a4c4345153 Nikolay Borisov 2018-08-15 2026 * Error, btrfs_run_delayed_refs_for_head already
0110a4c4345153 Nikolay Borisov 2018-08-15 2027 * unlocked everything so just bail out
0110a4c4345153 Nikolay Borisov 2018-08-15 2028 */
0110a4c4345153 Nikolay Borisov 2018-08-15 2029 return ret;
0110a4c4345153 Nikolay Borisov 2018-08-15 2030 } else if (!ret) {
0110a4c4345153 Nikolay Borisov 2018-08-15 2031 /*
0110a4c4345153 Nikolay Borisov 2018-08-15 2032 * Success, perform the usual cleanup of a processed
0110a4c4345153 Nikolay Borisov 2018-08-15 2033 * head
c1103f7a5d7a54 Josef Bacik 2017-09-29 2034 */
f9871eddd9cb1a Nikolay Borisov 2018-06-20 2035 ret = cleanup_ref_head(trans, locked_ref);
194ab0bc21cc99 Josef Bacik 2017-09-29 2036 if (ret > 0 ) {
b00e62507ec6a9 Josef Bacik 2017-09-29 2037 /* We dropped our lock, we need to loop. */
b00e62507ec6a9 Josef Bacik 2017-09-29 2038 ret = 0;
d7df2c796d7eed Josef Bacik 2014-01-23 2039 continue;
194ab0bc21cc99 Josef Bacik 2017-09-29 2040 } else if (ret) {
194ab0bc21cc99 Josef Bacik 2017-09-29 2041 return ret;
56bec294dea971 Chris Mason 2009-03-13 2042 }
22cd2e7de7b0bd Arne Jansen 2012-08-09 2043 }
1ce7a5ec44c8b1 Josef Bacik 2017-09-29 2044
b00e62507ec6a9 Josef Bacik 2017-09-29 2045 /*
0110a4c4345153 Nikolay Borisov 2018-08-15 2046 * Either success case or btrfs_run_delayed_refs_for_head
0110a4c4345153 Nikolay Borisov 2018-08-15 2047 * returned -EAGAIN, meaning we need to select another head
b00e62507ec6a9 Josef Bacik 2017-09-29 2048 */
eb099670895f22 Josef Bacik 2009-02-12 2049
0110a4c4345153 Nikolay Borisov 2018-08-15 2050 locked_ref = NULL;
c3e69d58e86c39 Chris Mason 2009-03-13 2051 cond_resched();
0110a4c4345153 Nikolay Borisov 2018-08-15 2052 } while ((nr != -1 && count < nr) || locked_ref);
0a2b2a844af616 Josef Bacik 2014-01-23 2053
0a2b2a844af616 Josef Bacik 2014-01-23 2054 /*
0a2b2a844af616 Josef Bacik 2014-01-23 2055 * We don't want to include ref heads since we can have empty ref heads
0a2b2a844af616 Josef Bacik 2014-01-23 2056 * and those will drastically skew our runtime down since we just do
0a2b2a844af616 Josef Bacik 2014-01-23 2057 * accounting, no actual extent tree updates.
0a2b2a844af616 Josef Bacik 2014-01-23 2058 */
0a2b2a844af616 Josef Bacik 2014-01-23 2059 if (actual_count > 0) {
0a2b2a844af616 Josef Bacik 2014-01-23 2060 u64 runtime = ktime_to_ns(ktime_sub(ktime_get(), start));
0a2b2a844af616 Josef Bacik 2014-01-23 2061 u64 avg;
0a2b2a844af616 Josef Bacik 2014-01-23 2062
0a2b2a844af616 Josef Bacik 2014-01-23 2063 /*
0a2b2a844af616 Josef Bacik 2014-01-23 2064 * We weigh the current average higher than our current runtime
0a2b2a844af616 Josef Bacik 2014-01-23 2065 * to avoid large swings in the average.
0a2b2a844af616 Josef Bacik 2014-01-23 2066 */
0a2b2a844af616 Josef Bacik 2014-01-23 2067 spin_lock(&delayed_refs->lock);
0a2b2a844af616 Josef Bacik 2014-01-23 2068 avg = fs_info->avg_delayed_ref_runtime * 3 + runtime;
f8c269d7223f6b David Sterba 2015-01-16 2069 fs_info->avg_delayed_ref_runtime = avg >> 2; /* div by 4 */
0a2b2a844af616 Josef Bacik 2014-01-23 2070 spin_unlock(&delayed_refs->lock);
0a2b2a844af616 Josef Bacik 2014-01-23 2071 }
d7df2c796d7eed Josef Bacik 2014-01-23 2072 return 0;
c3e69d58e86c39 Chris Mason 2009-03-13 2073 }
c3e69d58e86c39 Chris Mason 2009-03-13 2074

:::::: The code at line 1983 was first introduced by commit
:::::: d7df2c796d7eedd72a334dc89c65e1fec8171431 Btrfs: attach delayed ref updates to delayed ref heads

:::::: TO: Josef Bacik <jbacik@xxxxxx>
:::::: CC: Chris Mason <clm@xxxxxx>

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

Attachment: .config.gz
Description: application/gzip