Re: [PATCH V10] cgroup/rstat: Avoid flushing if there is an ongoing root flush

From: kernel test robot
Date: Tue Sep 10 2024 - 01:23:44 EST


Hi Jesper,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tj-cgroup/for-next]
[also build test WARNING on axboe-block/for-next akpm-mm/mm-everything linus/master v6.11-rc7 next-20240909]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jesper-Dangaard-Brouer/cgroup-rstat-Avoid-flushing-if-there-is-an-ongoing-root-flush/20240905-034221
base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
patch link: https://lore.kernel.org/r/172547884995.206112.808619042206173396.stgit%40firesoul
patch subject: [PATCH V10] cgroup/rstat: Avoid flushing if there is an ongoing root flush
config: hexagon-randconfig-r121-20240910 (https://download.01.org/0day-ci/archive/20240910/202409101356.VXPFCu6l-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce: (https://download.01.org/0day-ci/archive/20240910/202409101356.VXPFCu6l-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409101356.VXPFCu6l-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> kernel/cgroup/rstat.c:339:23: sparse: sparse: Using plain integer as NULL pointer
kernel/cgroup/rstat.c:87:18: sparse: sparse: context imbalance in 'cgroup_rstat_updated' - different lock contexts for basic block
kernel/cgroup/rstat.c:75:9: sparse: sparse: context imbalance in 'cgroup_rstat_updated_list' - wrong count at exit
kernel/cgroup/rstat.c:320:13: sparse: sparse: context imbalance in 'cgroup_rstat_trylock_flusher' - wrong count at exit
kernel/cgroup/rstat.c:300:34: sparse: sparse: context imbalance in 'cgroup_rstat_unlock_flusher' - unexpected unlock
kernel/cgroup/rstat.c:373:9: sparse: sparse: context imbalance in 'cgroup_rstat_flush_locked' - different lock contexts for basic block
kernel/cgroup/rstat.c:447:9: sparse: sparse: context imbalance in 'cgroup_rstat_flush_hold' - wrong count at exit
kernel/cgroup/rstat.c:457:6: sparse: sparse: context imbalance in 'cgroup_rstat_flush_release' - wrong count at exit

vim +339 kernel/cgroup/rstat.c

308
309 /**
310 * cgroup_rstat_trylock_flusher - Trylock that checks for on ongoing flusher
311 * @cgrp: target cgroup
312 *
313 * Function return value follow trylock semantics. Returning true when lock is
314 * obtained. Returning false when not locked and it detected flushing can be
315 * skipped as another ongoing flusher is taking care of the flush.
316 *
317 * For callers that depend on flush completing before returning a strict option
318 * is provided.
319 */
320 static bool cgroup_rstat_trylock_flusher(struct cgroup *cgrp, bool strict)
321 {
322 struct cgroup *ongoing;
323
324 if (strict)
325 goto lock;
326
327 /*
328 * Check if ongoing flusher is already taking care of this. Descendant
329 * check is necessary due to cgroup v1 supporting multiple root's.
330 */
331 ongoing = READ_ONCE(cgrp_rstat_ongoing_flusher);
332 if (ongoing && cgroup_is_descendant(cgrp, ongoing))
333 return false;
334
335 /* Grab right to be ongoing flusher */
336 if (!ongoing && cgroup_is_root(cgrp)) {
337 struct cgroup *old;
338
> 339 old = cmpxchg(&cgrp_rstat_ongoing_flusher, NULL, cgrp);
340 if (old) {
341 /* Lost race for being ongoing flusher */
342 if (cgroup_is_descendant(cgrp, old))
343 return false;
344 }
345 /* Due to lock yield combined with strict mode record ID */
346 WRITE_ONCE(cgrp_rstat_ongoing_flusher_ID, current);
347 }
348 lock:
349 __cgroup_rstat_lock(cgrp, -1);
350
351 return true;
352 }
353

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