linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 10182/10862] fs/bcachefs/btree_cache.c:452:13-14: Unneeded semicolon
Date: Wed, 11 Sep 2024 22:10:29 +0800	[thread overview]
Message-ID: <202409112245.V7Yx5g8S-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   32ffa5373540a8d1c06619f52d019c6cdc948bb4
commit: 4a4dd0714322bb7338902cd7efad725307ea0dee [10182/10862] bcachefs: Don't count "skipped access bit" as touched in btree cache scan
config: loongarch-randconfig-r063-20240911 (https://download.01.org/0day-ci/archive/20240911/202409112245.V7Yx5g8S-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409112245.V7Yx5g8S-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/bcachefs/btree_cache.c:452:13-14: Unneeded semicolon

vim +452 fs/bcachefs/btree_cache.c

   391	
   392	static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
   393						   struct shrink_control *sc)
   394	{
   395		struct bch_fs *c = shrink->private_data;
   396		struct btree_cache *bc = &c->btree_cache;
   397		struct btree *b, *t;
   398		unsigned long nr = sc->nr_to_scan;
   399		unsigned long can_free = 0;
   400		unsigned long freed = 0;
   401		unsigned long touched = 0;
   402		unsigned i, flags;
   403		unsigned long ret = SHRINK_STOP;
   404		bool trigger_writes = atomic_read(&bc->dirty) + nr >=
   405			bc->used * 3 / 4;
   406	
   407		if (bch2_btree_shrinker_disabled)
   408			return SHRINK_STOP;
   409	
   410		mutex_lock(&bc->lock);
   411		flags = memalloc_nofs_save();
   412	
   413		/*
   414		 * It's _really_ critical that we don't free too many btree nodes - we
   415		 * have to always leave ourselves a reserve. The reserve is how we
   416		 * guarantee that allocating memory for a new btree node can always
   417		 * succeed, so that inserting keys into the btree can always succeed and
   418		 * IO can always make forward progress:
   419		 */
   420		can_free = btree_cache_can_free(bc);
   421		nr = min_t(unsigned long, nr, can_free);
   422	
   423		i = 0;
   424		list_for_each_entry_safe(b, t, &bc->freeable, list) {
   425			/*
   426			 * Leave a few nodes on the freeable list, so that a btree split
   427			 * won't have to hit the system allocator:
   428			 */
   429			if (++i <= 3)
   430				continue;
   431	
   432			touched++;
   433	
   434			if (touched >= nr)
   435				goto out;
   436	
   437			if (!btree_node_reclaim(c, b, true)) {
   438				btree_node_data_free(c, b);
   439				six_unlock_write(&b->c.lock);
   440				six_unlock_intent(&b->c.lock);
   441				freed++;
   442				bc->freed++;
   443			}
   444		}
   445	restart:
   446		list_for_each_entry_safe(b, t, &bc->live, list) {
   447			touched++;
   448	
   449			if (btree_node_accessed(b)) {
   450				clear_btree_node_accessed(b);
   451				bc->not_freed[BCH_BTREE_CACHE_NOT_FREED_access_bit]++;
 > 452				--touched;;
   453			} else if (!btree_node_reclaim(c, b, true)) {
   454				freed++;
   455				btree_node_data_free(c, b);
   456				bc->freed++;
   457	
   458				bch2_btree_node_hash_remove(bc, b);
   459				six_unlock_write(&b->c.lock);
   460				six_unlock_intent(&b->c.lock);
   461	
   462				if (freed == nr)
   463					goto out_rotate;
   464			} else if (trigger_writes &&
   465				   btree_node_dirty(b) &&
   466				   !btree_node_will_make_reachable(b) &&
   467				   !btree_node_write_blocked(b) &&
   468				   six_trylock_read(&b->c.lock)) {
   469				list_move(&bc->live, &b->list);
   470				mutex_unlock(&bc->lock);
   471				__bch2_btree_node_write(c, b, BTREE_WRITE_cache_reclaim);
   472				six_unlock_read(&b->c.lock);
   473				if (touched >= nr)
   474					goto out_nounlock;
   475				mutex_lock(&bc->lock);
   476				goto restart;
   477			}
   478	
   479			if (touched >= nr)
   480				break;
   481		}
   482	out_rotate:
   483		if (&t->list != &bc->live)
   484			list_move_tail(&bc->live, &t->list);
   485	out:
   486		mutex_unlock(&bc->lock);
   487	out_nounlock:
   488		ret = freed;
   489		memalloc_nofs_restore(flags);
   490		trace_and_count(c, btree_cache_scan, sc->nr_to_scan, can_free, ret);
   491		return ret;
   492	}
   493	

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


                 reply	other threads:[~2024-09-11 14:11 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=202409112245.V7Yx5g8S-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox