]> www.infradead.org Git - users/willy/xarray.git/commitdiff
cgroup: remove cgroup_rstat_flush_atomic()
authorYosry Ahmed <yosryahmed@google.com>
Fri, 21 Apr 2023 17:40:20 +0000 (17:40 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 9 Jun 2023 23:25:15 +0000 (16:25 -0700)
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>
include/linux/cgroup.h
kernel/cgroup/rstat.c

index 885f5395fcd04e5e5310e8c1019c0ad7ff9b2535..567c547cf371f24a00c4d21f206dde43b3fe5b28 100644 (file)
@@ -692,7 +692,6 @@ static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
  */
 void cgroup_rstat_updated(struct cgroup *cgrp, int cpu);
 void cgroup_rstat_flush(struct cgroup *cgrp);
-void cgroup_rstat_flush_atomic(struct cgroup *cgrp);
 void cgroup_rstat_flush_hold(struct cgroup *cgrp);
 void cgroup_rstat_flush_release(void);
 
index 9c4c55228567ad10606d24af12834d733ff70ed9..2542c21b6b6d782f7a6786d8c74caee5e58c8a26 100644 (file)
@@ -171,7 +171,7 @@ __weak noinline void bpf_rstat_flush(struct cgroup *cgrp,
 __diag_pop();
 
 /* see cgroup_rstat_flush() */
-static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
+static void cgroup_rstat_flush_locked(struct cgroup *cgrp)
        __releases(&cgroup_rstat_lock) __acquires(&cgroup_rstat_lock)
 {
        int cpu;
@@ -207,9 +207,8 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
                }
                raw_spin_unlock_irqrestore(cpu_lock, flags);
 
-               /* if @may_sleep, play nice and yield if necessary */
-               if (may_sleep && (need_resched() ||
-                                 spin_needbreak(&cgroup_rstat_lock))) {
+               /* play nice and yield if necessary */
+               if (need_resched() || spin_needbreak(&cgroup_rstat_lock)) {
                        spin_unlock_irq(&cgroup_rstat_lock);
                        if (!cond_resched())
                                cpu_relax();
@@ -236,25 +235,10 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp)
        might_sleep();
 
        spin_lock_irq(&cgroup_rstat_lock);
-       cgroup_rstat_flush_locked(cgrp, true);
+       cgroup_rstat_flush_locked(cgrp);
        spin_unlock_irq(&cgroup_rstat_lock);
 }
 
-/**
- * cgroup_rstat_flush_atomic- atomic version of cgroup_rstat_flush()
- * @cgrp: target cgroup
- *
- * This function can be called from any context.
- */
-void cgroup_rstat_flush_atomic(struct cgroup *cgrp)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&cgroup_rstat_lock, flags);
-       cgroup_rstat_flush_locked(cgrp, false);
-       spin_unlock_irqrestore(&cgroup_rstat_lock, flags);
-}
-
 /**
  * cgroup_rstat_flush_hold - flush stats in @cgrp's subtree and hold
  * @cgrp: target cgroup
@@ -269,7 +253,7 @@ void cgroup_rstat_flush_hold(struct cgroup *cgrp)
 {
        might_sleep();
        spin_lock_irq(&cgroup_rstat_lock);
-       cgroup_rstat_flush_locked(cgrp, true);
+       cgroup_rstat_flush_locked(cgrp);
 }
 
 /**