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>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
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>,
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)),
bpf@vger.kernel.org (open list:BPF
[MISC]:Keyword:(?:\b|_)bpf(?:\b|_)),
Ridong Chen <ridong.chen@linux.dev>,
Ridong Chen <chenridong@xiaomi.com>
Subject: [PATCH RFC v3 5/7] mm/vmscan: pass scan_control to the LRU isolate/shrink tracepoints
Date: Tue, 13 Oct 2026 21:13:07 +0800 [thread overview]
Message-ID: <20261013131309.2790253-6-ridong.chen@linux.dev> (raw)
In-Reply-To: <20261013131309.2790253-1-ridong.chen@linux.dev>
From: Ridong Chen <chenridong@xiaomi.com>
mm_vmscan_lru_isolate, mm_vmscan_lru_shrink_inactive and
mm_vmscan_lru_shrink_active spell out reclaim state (reclaim_idx, order,
priority) as individual arguments, all of which the caller already holds
in struct scan_control. Now that the struct is visible from the trace
header, pass sc directly and pick the fields out in TP_fast_assign.
No functional change. The tracefs event format (TP_STRUCT__entry and
TP_printk) is unchanged, so tracefs-based consumers are unaffected.
BPF programs attached via raw_tp/tp_btf see the new TP_PROTO and need
to be adjusted; tracepoints are not a stable ABI (see
Documentation/bpf/bpf_design_QA.rst).
Assisted-by: LLM
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
---
mm/trace_vmscan.h | 31 +++++++++++++++----------------
mm/vmscan.c | 14 +++++++-------
2 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/mm/trace_vmscan.h b/mm/trace_vmscan.h
index 28561fda83b3..aa27cb9524bb 100644
--- a/mm/trace_vmscan.h
+++ b/mm/trace_vmscan.h
@@ -350,15 +350,14 @@ TRACE_EVENT(mm_shrink_slab_end,
);
TRACE_EVENT(mm_vmscan_lru_isolate,
- TP_PROTO(int highest_zoneidx,
- int order,
- unsigned long nr_requested,
- unsigned long nr_scanned,
- unsigned long nr_skipped,
- unsigned long nr_taken,
- int lru),
+ TP_PROTO(struct scan_control *sc,
+ unsigned long nr_requested,
+ unsigned long nr_scanned,
+ unsigned long nr_skipped,
+ unsigned long nr_taken,
+ int lru),
- TP_ARGS(highest_zoneidx, order, nr_requested, nr_scanned, nr_skipped, nr_taken, lru),
+ TP_ARGS(sc, nr_requested, nr_scanned, nr_skipped, nr_taken, lru),
TP_STRUCT__entry(
__field(int, highest_zoneidx)
@@ -371,8 +370,8 @@ TRACE_EVENT(mm_vmscan_lru_isolate,
),
TP_fast_assign(
- __entry->highest_zoneidx = highest_zoneidx;
- __entry->order = order;
+ __entry->highest_zoneidx = sc->reclaim_idx;
+ __entry->order = sc->order;
__entry->nr_requested = nr_requested;
__entry->nr_scanned = nr_scanned;
__entry->nr_skipped = nr_skipped;
@@ -466,9 +465,9 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
TP_PROTO(int nid,
unsigned long nr_scanned, unsigned long nr_reclaimed,
- struct reclaim_stat *stat, int priority, int file),
+ struct reclaim_stat *stat, struct scan_control *sc, int file),
- TP_ARGS(nid, nr_scanned, nr_reclaimed, stat, priority, file),
+ TP_ARGS(nid, nr_scanned, nr_reclaimed, stat, sc, file),
TP_STRUCT__entry(
__field(int, nid)
@@ -498,7 +497,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
__entry->nr_activate1 = stat->nr_activate[1];
__entry->nr_ref_keep = stat->nr_ref_keep;
__entry->nr_unmap_fail = stat->nr_unmap_fail;
- __entry->priority = priority;
+ __entry->priority = sc->priority;
__entry->reclaim_flags = trace_reclaim_flags(file);
),
@@ -517,9 +516,9 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active,
TP_PROTO(int nid, unsigned long nr_taken,
unsigned long nr_active, unsigned long nr_deactivated,
- unsigned long nr_referenced, int priority, int file),
+ unsigned long nr_referenced, struct scan_control *sc, int file),
- TP_ARGS(nid, nr_taken, nr_active, nr_deactivated, nr_referenced, priority, file),
+ TP_ARGS(nid, nr_taken, nr_active, nr_deactivated, nr_referenced, sc, file),
TP_STRUCT__entry(
__field(int, nid)
@@ -537,7 +536,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active,
__entry->nr_active = nr_active;
__entry->nr_deactivated = nr_deactivated;
__entry->nr_referenced = nr_referenced;
- __entry->priority = priority;
+ __entry->priority = sc->priority;
__entry->reclaim_flags = trace_reclaim_flags(file);
),
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2979d0d819a8..c25ba910149d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1764,7 +1764,7 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
}
}
*nr_scanned = total_scan;
- trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, nr_to_scan,
+ trace_mm_vmscan_lru_isolate(sc, nr_to_scan,
total_scan, skipped, nr_taken, lru);
update_lru_sizes(lruvec, lru, nr_zone_taken);
return nr_taken;
@@ -2053,7 +2053,7 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan,
handle_reclaim_writeback(nr_taken, pgdat, sc, &stat);
trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id,
- nr_scanned, nr_reclaimed, &stat, sc->priority, file);
+ nr_scanned, nr_reclaimed, &stat, sc, file);
return nr_reclaimed;
}
@@ -2160,7 +2160,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
mod_lruvec_state(lruvec, PGROTATE_ANON + file, nr_rotated);
trace_mm_vmscan_lru_shrink_active(pgdat->node_id, nr_taken, nr_activate,
- nr_deactivate, nr_rotated, sc->priority, file);
+ nr_deactivate, nr_rotated, sc, file);
}
static unsigned int reclaim_folio_list(struct list_head *folio_list,
@@ -4850,9 +4850,9 @@ static int scan_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
mod_lruvec_state(lruvec, item, isolated);
mod_lruvec_state(lruvec, PGREFILL, sorted);
mod_lruvec_state(lruvec, PGSCAN_ANON + type, isolated);
- trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, nr_to_scan,
- scanned, skipped, isolated,
- type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON);
+ trace_mm_vmscan_lru_isolate(sc, nr_to_scan,
+ scanned, skipped, isolated,
+ type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON);
*isolatedp = isolated;
return scanned;
@@ -4991,7 +4991,7 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
if (isolated)
handle_reclaim_writeback(isolated, pgdat, sc, &stat);
trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id,
- type_scanned, reclaimed, &stat, sc->priority,
+ type_scanned, reclaimed, &stat, sc,
type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON);
list_for_each_entry_safe_reverse(folio, next, &list, lru) {
--
2.34.1
next prev parent reply other threads:[~2026-10-13 13:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 13:13 [PATCH RFC v3 0/7] mm/vmscan: move vmscan tracepoints to a local header Ridong Chen
2026-10-13 13:13 ` [PATCH RFC v3 1/7] mm/memcontrol: drop unused vmscan tracepoint include Ridong Chen
2026-10-13 13:13 ` [PATCH RFC v3 2/7] mm/vmscan: move vmscan tracepoints to a local header Ridong Chen
2026-10-13 13:13 ` [PATCH RFC v3 3/7] mm/vmscan: move struct scan_control to a dedicated header Ridong Chen
2026-10-13 13:13 ` [PATCH RFC v3 4/7] mm/vmscan: pass scan_control to the reclaim-begin tracepoints Ridong Chen
2026-10-13 13:13 ` Ridong Chen [this message]
2026-10-13 13:13 ` [PATCH RFC v3 6/7] mm/vmscan: pass scan_control to mm_vmscan_reclaim_pages Ridong Chen
2026-10-13 13:13 ` [PATCH RFC v3 7/7] mm/vmscan: pass scan_control to mm_vmscan_balance_pgdat_end Ridong Chen
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=20261013131309.2790253-6-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=bpf@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.