From: kernel test robot <lkp@intel.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [vbabka:slub-percpu-sheaves-v1r0 8/12] mm/slub.c:5029:18: warning: 'i' is used uninitialized
Date: Sat, 13 Jul 2024 13:29:28 +0800 [thread overview]
Message-ID: <202407131305.sMLSPyd9-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git slub-percpu-sheaves-v1r0
head: 9cb4096680ee90fe6be1b22ff3961174fa8e3ee4
commit: 6912a14dbbe63891a545d4cd35b60bcd3dee3d40 [8/12] mm/slub: add opt-in caching layer of percpu sheaves
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240713/202407131305.sMLSPyd9-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240713/202407131305.sMLSPyd9-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407131305.sMLSPyd9-lkp@intel.com/
All warnings (new ones prefixed by >>):
mm/slub.c: In function 'pcs_flush_all':
mm/slub.c:2434:36: warning: variable 'rcu_free' set but not used [-Wunused-but-set-variable]
2434 | struct slab_sheaf *spare, *rcu_free;
| ^~~~~~~~
mm/slub.c: In function 'slab_post_alloc_hook':
mm/slub.c:4299:29: warning: variable 'obj_exts' set but not used [-Wunused-but-set-variable]
4299 | struct slabobj_ext *obj_exts;
| ^~~~~~~~
mm/slub.c: In function 'free_to_pcs_bulk':
>> mm/slub.c:5029:18: warning: 'i' is used uninitialized [-Wuninitialized]
5029 | while (i < size) {
| ~~^~~~~~
mm/slub.c:5024:25: note: 'i' was declared here
5024 | unsigned batch, i;
| ^
vim +/i +5029 mm/slub.c
5013
5014 /*
5015 * Bulk free objects to the percpu sheaves.
5016 * Unlike free_to_pcs() this has includes the calls to all necessary hooks
5017 * and the fallback to freeing to slab pages.
5018 */
5019 static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p)
5020 {
5021 struct slub_percpu_sheaves *pcs;
5022 struct slab_sheaf *main;
5023 unsigned long flags;
5024 unsigned batch, i;
5025 bool init;
5026
5027 init = slab_want_init_on_free(s);
5028
> 5029 while (i < size) {
5030 struct slab *slab = virt_to_slab(p[i]);
5031
5032 memcg_slab_free_hook(s, slab, p[i], 1);
5033 alloc_tagging_slab_free_hook(s, slab, p[i], 1);
5034
5035 if (unlikely(!slab_free_hook(s, p[i], init))) {
5036 p[i] = p[--size];
5037 if (!size)
5038 return;
5039 continue;
5040 }
5041
5042 i++;
5043 }
5044
5045 next_batch:
5046 local_lock_irqsave(&s->cpu_sheaves->lock, flags);
5047 pcs = this_cpu_ptr(s->cpu_sheaves);
5048
5049 if (unlikely(pcs->main->size == s->sheaf_capacity)) {
5050
5051 struct slab_sheaf *empty;
5052
5053 if (!pcs->spare) {
5054 empty = barn_get_empty_sheaf(pcs->barn);
5055 if (empty) {
5056 pcs->spare = pcs->main;
5057 pcs->main = empty;
5058 goto do_free;
5059 }
5060 goto no_empty;
5061 }
5062
5063 if (pcs->spare->size < s->sheaf_capacity) {
5064 stat(s, SHEAF_SWAP);
5065 swap(pcs->main, pcs->spare);
5066 goto do_free;
5067 }
5068
5069 empty = barn_replace_full_sheaf(pcs->barn, pcs->main);
5070
5071 if (!IS_ERR(empty)) {
5072 pcs->main = empty;
5073 goto do_free;
5074 }
5075
5076 no_empty:
5077 local_unlock_irqrestore(&s->cpu_sheaves->lock, flags);
5078
5079 /*
5080 * if we depleted all empty sheafs in the barn or there are to
5081 * many full sheafs, free the rest to slab pages
5082 */
5083
5084 __kmem_cache_free_bulk(s, size, p);
5085 return;
5086 }
5087
5088 do_free:
5089 main = pcs->main;
5090 batch = min(size, s->sheaf_capacity - main->size);
5091
5092 memcpy(main->objects + main->size, p, batch * sizeof(void *));
5093 main->size += batch;
5094
5095 local_unlock_irqrestore(&s->cpu_sheaves->lock, flags);
5096
5097 stat_add(s, FREE_PCS, batch);
5098
5099 if (batch < size) {
5100 p += batch;
5101 size -= batch;
5102 goto next_batch;
5103 }
5104 }
5105
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-07-13 5:30 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=202407131305.sMLSPyd9-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=vbabka@suse.cz \
/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.