From: Ridong Chen <ridong.chen@linux.dev>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Chinner <david@fromorbit.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Muchun Song <muchun.song@linux.dev>,
Qi Zheng <qi.zheng@linux.dev>, Kairui Song <kasong@tencent.com>,
Barry Song <baohua@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
Baoquan He <baoquan.he@linux.dev>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY
RESOURCE CONTROLLER (MEMCG)),
linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE
CONTROLLER (MEMCG)), Ridong Chen <ridong.chen@linux.dev>,
Ridong Chen <chenridong@xiaomi.com>
Subject: [PATCH RFC 4/4] mm/vmscan: pass scan_control to the reclaim-begin tracepoints
Date: Mon, 21 Sep 2026 19:46:06 +0800 [thread overview]
Message-ID: <20260921114606.3871820-5-ridong.chen@linux.dev> (raw)
In-Reply-To: <20260921114606.3871820-1-ridong.chen@linux.dev>
From: Ridong Chen <chenridong@xiaomi.com>
The reclaim-begin tracepoints describe the entry conditions of a reclaim
invocation, which struct scan_control already carries. Now that the struct
is visible from the trace header, pass sc directly and pick the fields out
in TP_fast_assign instead of spelling out gfp_mask and order at every
callsite. The exported event format is unchanged.
No functional change.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
---
mm/trace_vmscan.h | 24 ++++++++++++------------
mm/vmscan.c | 7 +++----
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/mm/trace_vmscan.h b/mm/trace_vmscan.h
index c8ac5d4e4043..c9f16267c0a2 100644
--- a/mm/trace_vmscan.h
+++ b/mm/trace_vmscan.h
@@ -291,9 +291,9 @@ TRACE_EVENT(mm_vmscan_wakeup_kswapd,
DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
- TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg),
+ TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg),
- TP_ARGS(gfp_flags, order, memcg),
+ TP_ARGS(sc, memcg),
TP_STRUCT__entry(
__field( unsigned long, gfp_flags )
@@ -302,8 +302,8 @@ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
),
TP_fast_assign(
- __entry->gfp_flags = (__force unsigned long)gfp_flags;
- __entry->order = order;
+ __entry->gfp_flags = (__force unsigned long)sc->gfp_mask;
+ __entry->order = sc->order;
__entry->memcg_id = mem_cgroup_id(memcg);
),
@@ -317,17 +317,17 @@ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
- TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg),
+ TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg),
- TP_ARGS(gfp_flags, order, memcg)
+ TP_ARGS(sc, memcg)
);
#ifdef CONFIG_MEMCG
DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
- TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg),
+ TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg),
- TP_ARGS(gfp_flags, order, memcg)
+ TP_ARGS(sc, memcg)
);
#endif /* CONFIG_MEMCG */
@@ -664,9 +664,9 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active,
TRACE_EVENT(mm_vmscan_node_reclaim_begin,
- TP_PROTO(int nid, int order, gfp_t gfp_flags),
+ TP_PROTO(int nid, struct scan_control *sc),
- TP_ARGS(nid, order, gfp_flags),
+ TP_ARGS(nid, sc),
TP_STRUCT__entry(
__field(int, nid)
@@ -676,8 +676,8 @@ TRACE_EVENT(mm_vmscan_node_reclaim_begin,
TP_fast_assign(
__entry->nid = nid;
- __entry->order = order;
- __entry->gfp_flags = (__force unsigned long)gfp_flags;
+ __entry->order = sc->order;
+ __entry->gfp_flags = (__force unsigned long)sc->gfp_mask;
),
TP_printk("nid=%d order=%d gfp_flags=%s",
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2fd9b42f89d8..2fed83738b4b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -6885,7 +6885,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
return 1;
set_task_reclaim_state(current, &sc.reclaim_state);
- trace_mm_vmscan_direct_reclaim_begin(sc.gfp_mask, order, NULL);
+ trace_mm_vmscan_direct_reclaim_begin(&sc, NULL);
nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
@@ -6926,7 +6926,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
struct zonelist *zonelist = node_zonelist(numa_node_id(), sc.gfp_mask);
set_task_reclaim_state(current, &sc.reclaim_state);
- trace_mm_vmscan_memcg_reclaim_begin(sc.gfp_mask, 0, memcg);
+ trace_mm_vmscan_memcg_reclaim_begin(&sc, memcg);
noreclaim_flag = memalloc_noreclaim_save();
nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
@@ -7882,8 +7882,7 @@ static unsigned long __node_reclaim(struct pglist_data *pgdat,
unsigned int noreclaim_flag;
unsigned long pflags;
- trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, sc->order,
- sc->gfp_mask);
+ trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, sc);
cond_resched();
psi_memstall_enter(&pflags);
--
2.34.1
prev parent reply other threads:[~2026-09-21 11:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 11:46 [PATCH RFC 0/4] mm/vmscan: move vmscan tracepoints to a local header Ridong Chen
2026-09-21 11:46 ` [PATCH RFC 1/4] mm/memcontrol: drop unused vmscan tracepoint include Ridong Chen
2026-09-21 11:46 ` [PATCH RFC 2/4] mm/vmscan: move vmscan tracepoints to a local header Ridong Chen
2026-09-21 11:46 ` [PATCH RFC 3/4] mm/vmscan: move struct scan_control to the local trace header Ridong Chen
2026-09-22 2:24 ` Baoquan He
2026-09-22 2:37 ` Ridong Chen
2026-09-21 11:46 ` Ridong Chen [this message]
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=20260921114606.3871820-5-ridong.chen@linux.dev \
--to=ridong.chen@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@xiaomi.com \
--cc=david@fromorbit.com \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=qi.zheng@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=yuanchu@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
all inboxes | Powered by JetHome®