Skip to content

Commit 3eba050

Browse files
Chengming ZhouPeter Zijlstra
authored andcommitted
sched/cpuacct: Remove redundant RCU read lock
The cpuacct_account_field() and it's cgroup v2 wrapper cgroup_account_cputime_field() is only called from cputime in task_group_account_field(), which is already in RCU read-side critical section. So remove these redundant RCU read lock. Suggested-by: Tejun Heo <[email protected]> Signed-off-by: Chengming Zhou <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent dc6e081 commit 3eba050

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

include/linux/cgroup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,9 @@ static inline void cgroup_account_cputime_field(struct task_struct *task,
804804

805805
cpuacct_account_field(task, index, delta_exec);
806806

807-
rcu_read_lock();
808807
cgrp = task_dfl_cgroup(task);
809808
if (cgroup_parent(cgrp))
810809
__cgroup_account_cputime_field(cgrp, index, delta_exec);
811-
rcu_read_unlock();
812810
}
813811

814812
#else /* CONFIG_CGROUPS */

kernel/sched/cpuacct.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,8 @@ void cpuacct_account_field(struct task_struct *tsk, int index, u64 val)
352352
{
353353
struct cpuacct *ca;
354354

355-
rcu_read_lock();
356355
for (ca = task_ca(tsk); ca != &root_cpuacct; ca = parent_ca(ca))
357356
__this_cpu_add(ca->cpustat->cpustat[index], val);
358-
rcu_read_unlock();
359357
}
360358

361359
struct cgroup_subsys cpuacct_cgrp_subsys = {

0 commit comments

Comments
 (0)