Skip to content

Commit 0a2dc6a

Browse files
yosrym93akpm00
authored andcommitted
cgroup: remove cgroup_rstat_flush_atomic()
Previous patches removed the only caller of cgroup_rstat_flush_atomic(). Remove the function and simplify the code. Link: https://lkml.kernel.org/r/20230421174020.2994750-6-yosryahmed@google.com Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Acked-by: Shakeel Butt <shakeelb@google.com> Acked-by: Tejun Heo <tj@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Michal Koutný <mkoutny@suse.com> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 35822fd commit 0a2dc6a

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

include/linux/cgroup.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
692692
*/
693693
void cgroup_rstat_updated(struct cgroup *cgrp, int cpu);
694694
void cgroup_rstat_flush(struct cgroup *cgrp);
695-
void cgroup_rstat_flush_atomic(struct cgroup *cgrp);
696695
void cgroup_rstat_flush_hold(struct cgroup *cgrp);
697696
void cgroup_rstat_flush_release(void);
698697

kernel/cgroup/rstat.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ __weak noinline void bpf_rstat_flush(struct cgroup *cgrp,
171171
__diag_pop();
172172

173173
/* see cgroup_rstat_flush() */
174-
static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
174+
static void cgroup_rstat_flush_locked(struct cgroup *cgrp)
175175
__releases(&cgroup_rstat_lock) __acquires(&cgroup_rstat_lock)
176176
{
177177
int cpu;
@@ -207,9 +207,8 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
207207
}
208208
raw_spin_unlock_irqrestore(cpu_lock, flags);
209209

210-
/* if @may_sleep, play nice and yield if necessary */
211-
if (may_sleep && (need_resched() ||
212-
spin_needbreak(&cgroup_rstat_lock))) {
210+
/* play nice and yield if necessary */
211+
if (need_resched() || spin_needbreak(&cgroup_rstat_lock)) {
213212
spin_unlock_irq(&cgroup_rstat_lock);
214213
if (!cond_resched())
215214
cpu_relax();
@@ -236,25 +235,10 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp)
236235
might_sleep();
237236

238237
spin_lock_irq(&cgroup_rstat_lock);
239-
cgroup_rstat_flush_locked(cgrp, true);
238+
cgroup_rstat_flush_locked(cgrp);
240239
spin_unlock_irq(&cgroup_rstat_lock);
241240
}
242241

243-
/**
244-
* cgroup_rstat_flush_atomic- atomic version of cgroup_rstat_flush()
245-
* @cgrp: target cgroup
246-
*
247-
* This function can be called from any context.
248-
*/
249-
void cgroup_rstat_flush_atomic(struct cgroup *cgrp)
250-
{
251-
unsigned long flags;
252-
253-
spin_lock_irqsave(&cgroup_rstat_lock, flags);
254-
cgroup_rstat_flush_locked(cgrp, false);
255-
spin_unlock_irqrestore(&cgroup_rstat_lock, flags);
256-
}
257-
258242
/**
259243
* cgroup_rstat_flush_hold - flush stats in @cgrp's subtree and hold
260244
* @cgrp: target cgroup
@@ -269,7 +253,7 @@ void cgroup_rstat_flush_hold(struct cgroup *cgrp)
269253
{
270254
might_sleep();
271255
spin_lock_irq(&cgroup_rstat_lock);
272-
cgroup_rstat_flush_locked(cgrp, true);
256+
cgroup_rstat_flush_locked(cgrp);
273257
}
274258

275259
/**

0 commit comments

Comments
 (0)