From: Yosry Ahmed <yosryahmed@google.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeelb@google.com>,
Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org, linux-mm@kvack.org,
Yosry Ahmed <yosryahmed@google.com>
Subject: [PATCH mm-unstable RFC 5/5] cgroup: remove cgroup_rstat_flush_atomic()
Date: Mon, 3 Apr 2023 22:03:37 +0000 [thread overview]
Message-ID: <20230403220337.443510-6-yosryahmed@google.com> (raw)
In-Reply-To: <20230403220337.443510-1-yosryahmed@google.com>
Previous patches removed the only caller of cgroup_rstat_flush_atomic().
Remove the function and simplify the code.
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
---
include/linux/cgroup.h | 1 -
kernel/cgroup/rstat.c | 26 +++++---------------------
2 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 885f5395fcd04..567c547cf371f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -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);
diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index d3252b0416b69..f9ad33f117c82 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -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);
}
/**
--
2.40.0.348.gf938b09366-goog
next prev parent reply other threads:[~2023-04-03 22:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 22:03 [PATCH mm-unstable RFC 0/5] cgroup: eliminate atomic rstat Yosry Ahmed
2023-04-03 22:03 ` [PATCH mm-unstable RFC 1/5] writeback: move wb_over_bg_thresh() call outside lock section Yosry Ahmed
2023-04-19 11:38 ` Michal Koutný
2023-04-20 20:23 ` Yosry Ahmed
2023-04-20 18:53 ` Shakeel Butt
2023-04-20 20:22 ` Yosry Ahmed
2023-04-21 8:53 ` Jan Kara
2023-04-21 17:21 ` Yosry Ahmed
2023-04-03 22:03 ` [PATCH mm-unstable RFC 2/5] memcg: flush stats non-atomically in mem_cgroup_wb_stats() Yosry Ahmed
2023-04-19 11:44 ` Michal Koutný
2023-04-20 18:55 ` Shakeel Butt
2023-04-03 22:03 ` [PATCH mm-unstable RFC 3/5] memcg: calculate root usage from global state Yosry Ahmed
2023-04-11 12:53 ` Michal Koutný
2023-04-11 16:59 ` Yosry Ahmed
2023-04-20 18:57 ` Shakeel Butt
2023-04-03 22:03 ` [PATCH mm-unstable RFC 4/5] memcg: remove mem_cgroup_flush_stats_atomic() Yosry Ahmed
2023-04-20 19:38 ` Shakeel Butt
2023-04-03 22:03 ` Yosry Ahmed [this message]
2023-04-20 19:40 ` [PATCH mm-unstable RFC 5/5] cgroup: remove cgroup_rstat_flush_atomic() Shakeel Butt
2023-04-20 19:48 ` Tejun Heo
2023-04-20 20:19 ` Yosry Ahmed
2023-04-03 22:04 ` [PATCH mm-unstable RFC 0/5] cgroup: eliminate atomic rstat Yosry Ahmed
2023-04-06 18:26 ` Tim Chen
2023-04-06 18:23 ` Tim Chen
2023-04-17 11:54 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230403220337.443510-6-yosryahmed@google.com \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).