Skip to contentSkip to conversation

mm/bpf_memcontrol.c:355:43: warning: variable 'item' set but not used

PATCH kernel test robot 1 participant 1 message Nov 29

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://github.com/kkdwivedi/linux reclaim-ext
head:   6b721024b59ae84266e5c2b29fd390ba4fa9c362
commit: 3e016ddbafeaf29b30351e39c4918de15f176da6 [166/249] memcg_ext: allow BPF to defer memory.high enforcement
config: openrisc-randconfig-2200-20261129 (https://download.01.org/0day-ci/archive/20261129/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 16.2.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261129/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

mm/bpf_memcontrol.c: In function 'bpf_memcg_high_policy':

>> mm/bpf_memcontrol.c:355:43: warning: variable 'item' set but not used [-Wunused-but-set-variable=]
     355 |         const struct bpf_prog_array_item *item;
         |                                           ^~~~

vim +/item +355 mm/bpf_memcontrol.c

351
352 u32 bpf_memcg_high_policy(struct mem_cgroup *memcg,
353 struct mem_cgroup *over_limit, gfp_t gfp_mask)
354 {

 > 355		const struct bpf_prog_array_item *item;

356 const struct bpf_memcg_ops *ops;
357 struct bpf_memcg_ctx ctx;
358 u32 acc = BPF_MEMCG_HIGH_NO_OPINION;
359 struct cgroup *cgrp;
360
361 if (!cgroup_bpf_enabled(CGROUP_MEMCG_OPS))
362 return acc;
363
364 /*
365 * Only the default hierarchy has a cgroup_bpf, and the static key is
366 * global, so one policy anywhere turns this on for v1 memcgs too. A
367 * v1 memcg still cannot get here, because memory.high and swap.high
368 * are both v2-only and so it never builds the debt that leads to this
369 * call. A hook on a path v1 can reach needs its own cgroup_on_dfl()
370 * test: a v1 cgroup has no effective array and an uninitialised
371 * cgrp->bpf.refcnt.
372 */
373 cgrp = memcg->css.cgroup;
374
375 /*
376 * A program can allocate and re-enter the charge path. Skip the
377 * nested call. This guards the callbacks only.
378 */
379 if (current->in_bpf_memcg)
380 return acc;
381 current->in_bpf_memcg = 1;
382
383 rcu_read_lock_dont_migrate();
384
385 /*
386 * A memcg outlives its cgroup while it has charges, and
387 * cgroup_bpf_release() frees the arrays when the cgroup goes.
388 */
389 if (!cgroup_bpf_tryget_live(cgrp))
390 goto out;
391
392 bpf_memcg_ctx_init(&ctx, memcg, over_limit, gfp_mask);
393
394 bpf_cgroup_struct_ops_foreach(ops, item, cgrp, CGROUP_MEMCG_OPS) {
395 if (ops->high_policy)
396 acc |= ops->high_policy(&ctx) &
397 BPF_MEMCG_HIGH_VALID_MASK;
398 }
399
400 cgroup_bpf_put(cgrp);
401 out:
402 rcu_read_unlock_migrate();
403
404 current->in_bpf_memcg = 0;
405
406 return acc;
407 }
408

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