All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 10857/12188] fs/ext4/mballoc.c:989:9: sparse: sparse: context imbalance in 'ext4_mb_choose_next_group_cr1' - wrong count at exit
Date: Tue, 13 Apr 2021 01:07:27 +0800	[thread overview]
Message-ID: <202104130120.nLTTYEcE-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10919 bytes --]

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: Andreas Dilger <adilger@dilger.ca>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5df924d19629975d565da37eb7268c7bf4d491fe
commit: 196e402adf2e4cd66f101923409f1970ec5f1af3 [10857/12188] ext4: improve cr 0 / cr 1 group scanning
:::::: branch date: 4 hours ago
:::::: commit date: 3 days ago
config: h8300-randconfig-s032-20210412 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-280-g2cd6d34e-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=196e402adf2e4cd66f101923409f1970ec5f1af3
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 196e402adf2e4cd66f101923409f1970ec5f1af3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300 

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


sparse warnings: (new ones prefixed by >>)
>> fs/ext4/mballoc.c:989:9: sparse: sparse: context imbalance in 'ext4_mb_choose_next_group_cr1' - wrong count at exit
   fs/ext4/mballoc.c:1259:9: sparse: sparse: context imbalance in 'ext4_mb_init_cache' - different lock contexts for basic block
   fs/ext4/mballoc.c:2162:5: sparse: sparse: context imbalance in 'ext4_mb_try_best_found' - different lock contexts for basic block
   fs/ext4/mballoc.c:2190:5: sparse: sparse: context imbalance in 'ext4_mb_find_by_goal' - different lock contexts for basic block
   fs/ext4/mballoc.c:2477:12: sparse: sparse: context imbalance in 'ext4_mb_good_group_nolock' - wrong count at exit
   fs/ext4/mballoc.c:2692:87: sparse: sparse: context imbalance in 'ext4_mb_regular_allocator' - different lock contexts for basic block
   fs/ext4/mballoc.c:3391:17: sparse: sparse: context imbalance in 'ext4_mb_release' - different lock contexts for basic block
   fs/ext4/mballoc.c:3511:26: sparse: sparse: context imbalance in 'ext4_free_data_in_buddy' - wrong count at exit
   fs/ext4/mballoc.c:3727:15: sparse: sparse: context imbalance in 'ext4_mb_mark_diskspace_used' - different lock contexts for basic block
   fs/ext4/mballoc.c:3735:6: sparse: sparse: context imbalance in 'ext4_mb_mark_bb' - different lock contexts for basic block
   fs/ext4/mballoc.c:4057:13: sparse: sparse: context imbalance in 'ext4_discard_allocated_blocks' - different lock contexts for basic block
   fs/ext4/mballoc.c:4359:13: sparse: sparse: context imbalance in 'ext4_mb_put_pa' - different lock contexts for basic block
   fs/ext4/mballoc.c:4696:9: sparse: sparse: context imbalance in 'ext4_mb_discard_group_preallocations' - different lock contexts for basic block
   fs/ext4/mballoc.c:4849:9: sparse: sparse: context imbalance in 'ext4_discard_preallocations' - different lock contexts for basic block
   fs/ext4/mballoc.c:5144:9: sparse: sparse: context imbalance in 'ext4_mb_discard_lg_preallocations' - different lock contexts for basic block
   fs/ext4/mballoc.c:5789:9: sparse: sparse: context imbalance in 'ext4_free_blocks' - different lock contexts for basic block
   fs/ext4/mballoc.c:6089:15: sparse: sparse: context imbalance in 'ext4_group_add_blocks' - different lock contexts for basic block
   fs/ext4/mballoc.c: note: in included file (through include/linux/atomic.h, include/asm-generic/bitops/lock.h, arch/h8300/include/asm/bitops.h, ...):
   arch/h8300/include/asm/atomic.h:92:31: sparse: sparse: context imbalance in 'ext4_trim_extent' - wrong count at exit
   fs/ext4/mballoc.c:6153:1: sparse: sparse: context imbalance in 'ext4_trim_all_free' - different lock contexts for basic block
   fs/ext4/mballoc.c:6319:1: sparse: sparse: context imbalance in 'ext4_mballoc_query_range' - different lock contexts for basic block

vim +/ext4_mb_choose_next_group_cr1 +989 fs/ext4/mballoc.c

196e402adf2e4c Harshad Shirwadkar 2021-04-01  915  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  916  /*
196e402adf2e4c Harshad Shirwadkar 2021-04-01  917   * Choose next group by traversing average fragment size tree. Updates *new_cr
196e402adf2e4c Harshad Shirwadkar 2021-04-01  918   * if cr lvel needs an update. Sets EXT4_MB_SEARCH_NEXT_LINEAR to indicate that
196e402adf2e4c Harshad Shirwadkar 2021-04-01  919   * the linear search should continue for one iteration since there's lock
196e402adf2e4c Harshad Shirwadkar 2021-04-01  920   * contention on the rb tree lock.
196e402adf2e4c Harshad Shirwadkar 2021-04-01  921   */
196e402adf2e4c Harshad Shirwadkar 2021-04-01  922  static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *ac,
196e402adf2e4c Harshad Shirwadkar 2021-04-01  923  		int *new_cr, ext4_group_t *group, ext4_group_t ngroups)
196e402adf2e4c Harshad Shirwadkar 2021-04-01  924  {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  925  	struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  926  	int avg_fragment_size, best_so_far;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  927  	struct rb_node *node, *found;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  928  	struct ext4_group_info *grp;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  929  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  930  	/*
196e402adf2e4c Harshad Shirwadkar 2021-04-01  931  	 * If there is contention on the lock, instead of waiting for the lock
196e402adf2e4c Harshad Shirwadkar 2021-04-01  932  	 * to become available, just continue searching lineraly. We'll resume
196e402adf2e4c Harshad Shirwadkar 2021-04-01  933  	 * our rb tree search later starting at ac->ac_last_optimal_group.
196e402adf2e4c Harshad Shirwadkar 2021-04-01  934  	 */
196e402adf2e4c Harshad Shirwadkar 2021-04-01  935  	if (!read_trylock(&sbi->s_mb_rb_lock)) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  936  		ac->ac_flags |= EXT4_MB_SEARCH_NEXT_LINEAR;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  937  		return;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  938  	}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  939  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  940  	if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  941  		if (sbi->s_mb_stats)
196e402adf2e4c Harshad Shirwadkar 2021-04-01  942  			atomic_inc(&sbi->s_bal_cr1_bad_suggestions);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  943  		/* We have found something at CR 1 in the past */
196e402adf2e4c Harshad Shirwadkar 2021-04-01  944  		grp = ext4_get_group_info(ac->ac_sb, ac->ac_last_optimal_group);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  945  		for (found = rb_next(&grp->bb_avg_fragment_size_rb); found != NULL;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  946  		     found = rb_next(found)) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  947  			grp = rb_entry(found, struct ext4_group_info,
196e402adf2e4c Harshad Shirwadkar 2021-04-01  948  				       bb_avg_fragment_size_rb);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  949  			if (sbi->s_mb_stats)
196e402adf2e4c Harshad Shirwadkar 2021-04-01  950  				atomic64_inc(&sbi->s_bal_cX_groups_considered[1]);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  951  			if (likely(ext4_mb_good_group(ac, grp->bb_group, 1)))
196e402adf2e4c Harshad Shirwadkar 2021-04-01  952  				break;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  953  		}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  954  		goto done;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  955  	}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  956  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  957  	node = sbi->s_mb_avg_fragment_size_root.rb_node;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  958  	best_so_far = 0;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  959  	found = NULL;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  960  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  961  	while (node) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  962  		grp = rb_entry(node, struct ext4_group_info,
196e402adf2e4c Harshad Shirwadkar 2021-04-01  963  			       bb_avg_fragment_size_rb);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  964  		avg_fragment_size = 0;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  965  		if (ext4_mb_good_group(ac, grp->bb_group, 1)) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  966  			avg_fragment_size = grp->bb_fragments ?
196e402adf2e4c Harshad Shirwadkar 2021-04-01  967  				grp->bb_free / grp->bb_fragments : 0;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  968  			if (!best_so_far || avg_fragment_size < best_so_far) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  969  				best_so_far = avg_fragment_size;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  970  				found = node;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  971  			}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  972  		}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  973  		if (avg_fragment_size > ac->ac_g_ex.fe_len)
196e402adf2e4c Harshad Shirwadkar 2021-04-01  974  			node = node->rb_right;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  975  		else
196e402adf2e4c Harshad Shirwadkar 2021-04-01  976  			node = node->rb_left;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  977  	}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  978  
196e402adf2e4c Harshad Shirwadkar 2021-04-01  979  done:
196e402adf2e4c Harshad Shirwadkar 2021-04-01  980  	if (found) {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  981  		grp = rb_entry(found, struct ext4_group_info,
196e402adf2e4c Harshad Shirwadkar 2021-04-01  982  			       bb_avg_fragment_size_rb);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  983  		*group = grp->bb_group;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  984  		ac->ac_flags |= EXT4_MB_CR1_OPTIMIZED;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  985  	} else {
196e402adf2e4c Harshad Shirwadkar 2021-04-01  986  		*new_cr = 2;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  987  	}
196e402adf2e4c Harshad Shirwadkar 2021-04-01  988  
196e402adf2e4c Harshad Shirwadkar 2021-04-01 @989  	read_unlock(&sbi->s_mb_rb_lock);
196e402adf2e4c Harshad Shirwadkar 2021-04-01  990  	ac->ac_last_optimal_group = *group;
196e402adf2e4c Harshad Shirwadkar 2021-04-01  991  }
196e402adf2e4c Harshad Shirwadkar 2021-04-01  992  

---
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: 27600 bytes --]

                 reply	other threads:[~2021-04-12 17:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202104130120.nLTTYEcE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@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.