[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202509052150.4GQ04PJn-lkp@intel.com>
Date: Fri, 5 Sep 2025 21:17:52 +0800
From: kernel test robot <lkp@...el.com>
To: Yi Tao <escape@...ux.alibaba.com>, tj@...nel.org, hannes@...xchg.org,
mkoutny@...e.com
Cc: oe-kbuild-all@...ts.linux.dev, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] cgroup: replace global percpu_rwsem with
signal_struct->group_rwsem when writing cgroup.procs/threads
Hi Yi,
kernel test robot noticed the following build errors:
[auto build test ERROR on tj-cgroup/for-next]
[also build test ERROR on kees/for-next/execve akpm-mm/mm-everything tip/sched/core linus/master v6.17-rc4]
[cannot apply to next-20250905]
[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/Yi-Tao/cgroup-replace-global-percpu_rwsem-with-signal_struct-group_rwsem-when-writing-cgroup-procs-threads/20250904-194505
base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
patch link: https://lore.kernel.org/r/068d58f1f497bc4971c6ac0bae58bf53b98451fd.1756985260.git.escape%40linux.alibaba.com
patch subject: [PATCH v2 1/1] cgroup: replace global percpu_rwsem with signal_struct->group_rwsem when writing cgroup.procs/threads
config: i386-buildonly-randconfig-004-20250905 (https://download.01.org/0day-ci/archive/20250905/202509052150.4GQ04PJn-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250905/202509052150.4GQ04PJn-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509052150.4GQ04PJn-lkp@intel.com/
All errors (new ones prefixed by >>):
kernel/cgroup/cgroup.c: In function 'cgroup_attach_lock':
>> kernel/cgroup/cgroup.c:2511:28: error: 'favor_dynmods' undeclared (first use in this function); did you mean 'Opt_favordynmods'?
2511 | if (tsk && favor_dynmods)
| ^~~~~~~~~~~~~
| Opt_favordynmods
kernel/cgroup/cgroup.c:2511:28: note: each undeclared identifier is reported only once for each function it appears in
kernel/cgroup/cgroup.c: In function 'cgroup_attach_unlock':
kernel/cgroup/cgroup.c:2526:28: error: 'favor_dynmods' undeclared (first use in this function); did you mean 'Opt_favordynmods'?
2526 | if (tsk && favor_dynmods)
| ^~~~~~~~~~~~~
| Opt_favordynmods
vim +2511 kernel/cgroup/cgroup.c
2482
2483 /**
2484 * cgroup_attach_lock - Lock for ->attach()
2485 * @tsk: thread group to lock
2486 * @lock_threadgroup: whether to down_write rwsem
2487 *
2488 * cgroup migration sometimes needs to stabilize threadgroups against forks and
2489 * exits by write-locking cgroup_threadgroup_rwsem. However, some ->attach()
2490 * implementations (e.g. cpuset), also need to disable CPU hotplug.
2491 * Unfortunately, letting ->attach() operations acquire cpus_read_lock() can
2492 * lead to deadlocks.
2493 *
2494 * Bringing up a CPU may involve creating and destroying tasks which requires
2495 * read-locking threadgroup_rwsem, so threadgroup_rwsem nests inside
2496 * cpus_read_lock(). If we call an ->attach() which acquires the cpus lock while
2497 * write-locking threadgroup_rwsem, the locking order is reversed and we end up
2498 * waiting for an on-going CPU hotplug operation which in turn is waiting for
2499 * the threadgroup_rwsem to be released to create new tasks. For more details:
2500 *
2501 * http://lkml.kernel.org/r/20220711174629.uehfmqegcwn2lqzu@wubuntu
2502 *
2503 * Resolve the situation by always acquiring cpus_read_lock() before optionally
2504 * write-locking cgroup_threadgroup_rwsem. This allows ->attach() to assume that
2505 * CPU hotplug is disabled on entry.
2506 */
2507 void cgroup_attach_lock(struct task_struct *tsk, bool lock_threadgroup)
2508 {
2509 cpus_read_lock();
2510 if (lock_threadgroup) {
> 2511 if (tsk && favor_dynmods)
2512 down_write(&tsk->signal->group_rwsem);
2513 else
2514 percpu_down_write(&cgroup_threadgroup_rwsem);
2515 }
2516 }
2517
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists