From: JP Kobryn <inwardvessel@gmail.com>
To: shakeel.butt@linux.dev, hannes@cmpxchg.org,
yosryahmed@google.com, akpm@linux-foundation.org,
rostedt@goodmis.org
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org
Subject: [PATCH 2/2] memcg: use memcg flush tracepoint
Date: Thu, 24 Oct 2024 17:25:11 -0700 [thread overview]
Message-ID: <20241025002511.129899-3-inwardvessel@gmail.com> (raw)
In-Reply-To: <20241025002511.129899-1-inwardvessel@gmail.com>
Make use of the flush tracepoint within memcontrol.
Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
---
mm/memcontrol.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 18c3f513d766..f816737228fa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -613,8 +613,11 @@ void mem_cgroup_flush_stats(struct mem_cgroup *memcg)
if (!memcg)
memcg = root_mem_cgroup;
- if (memcg_vmstats_needs_flush(memcg->vmstats))
+ if (memcg_vmstats_needs_flush(memcg->vmstats)) {
+ trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_READER);
do_flush_stats(memcg);
+ } else
+ trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_READER_SKIP);
}
void mem_cgroup_flush_stats_ratelimited(struct mem_cgroup *memcg)
@@ -630,6 +633,7 @@ static void flush_memcg_stats_dwork(struct work_struct *w)
* Deliberately ignore memcg_vmstats_needs_flush() here so that flushing
* in latency-sensitive paths is as cheap as possible.
*/
+ trace_memcg_flush_stats(root_mem_cgroup, TRACE_MEMCG_FLUSH_PERIODIC);
do_flush_stats(root_mem_cgroup);
queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME);
}
@@ -5285,6 +5289,7 @@ bool obj_cgroup_may_zswap(struct obj_cgroup *objcg)
* mem_cgroup_flush_stats() ignores small changes. Use
* do_flush_stats() directly to get accurate stats for charging.
*/
+ trace_memcg_flush_stats(memcg, TRACE_MEMCG_FLUSH_ZSWAP);
do_flush_stats(memcg);
pages = memcg_page_state(memcg, MEMCG_ZSWAP_B) / PAGE_SIZE;
if (pages < max)
--
2.47.0
next prev parent reply other threads:[~2024-10-25 0:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 0:25 [PATCH 0/2] memcg: tracepoint for flushing stats JP Kobryn
2024-10-25 0:25 ` [PATCH 1/2] memcg: add memcg flush tracepoint event JP Kobryn
2024-10-25 0:25 ` JP Kobryn [this message]
2024-10-25 0:57 ` [PATCH 2/2] memcg: use memcg flush tracepoint Yosry Ahmed
2024-10-25 1:15 ` Shakeel Butt
2024-10-25 7:40 ` Yosry Ahmed
2024-10-25 17:04 ` JP Kobryn
2024-10-25 17:53 ` Yosry Ahmed
2024-10-25 18:26 ` JP Kobryn
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=20241025002511.129899-3-inwardvessel@gmail.com \
--to=inwardvessel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=rostedt@goodmis.org \
--cc=shakeel.butt@linux.dev \
--cc=yosryahmed@google.com \
/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