mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ridong Chen <ridong.chen@linux.dev>
To: Baoquan He <baoquan.he@linux.dev>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Kairui Song <kasong@tencent.com>, Qi Zheng <qi.zheng@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Barry Song <baohua@kernel.org>,
	Axel Rasmussen <axelrasmussen@google.com>,
	Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	David Hildenbrand <david@kernel.org>,
	Michal Hocko <mhocko@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	"open list:MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU)"
	<linux-mm@kvack.org>, Ridong Chen <chenridong@xiaomi.com>
Subject: Re: [PATCH v2 2/3] mm/mglru: add tracepoint for scan_folios()
Date: Tue, 15 Sep 2026 20:17:51 +0800	[thread overview]
Message-ID: <e38f2b80-20f2-4787-9e07-fb601552f550@linux.dev> (raw)
In-Reply-To: <aqkoeJvFzqpoGeaP@fedora>



On 9/15/2026 7:14 PM, Baoquan He wrote:
> On 09/11/26 at 06:29pm, Ridong Chen wrote:
>> From: Ridong Chen <chenridong@xiaomi.com>
> ...snip...
>> ---
>>   include/trace/events/vmscan.h | 63 +++++++++++++++++++++++++++++++++++
>>   mm/vmscan.c                   |  6 ++++
>>   2 files changed, 69 insertions(+)
>>
>> diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
>> index 8a872990b4be..5defa8f6719c 100644
>> --- a/include/trace/events/vmscan.h
>> +++ b/include/trace/events/vmscan.h
>> @@ -392,6 +392,69 @@ TRACE_EVENT(mm_vmscan_lru_isolate,
>>   		__print_symbolic(__entry->lru, LRU_NAMES))
>>   );
>>   
>> +TRACE_EVENT(mm_mglru_scan_folios,
>> +
>> +	TP_PROTO(struct lruvec *lruvec,
>> +		int highest_zoneidx,
>> +		int order,
>> +		unsigned long nr_requested,
>> +		unsigned long nr_scanned,
>> +		unsigned long nr_sorted,
>> +		unsigned long nr_skipped,
>> +		unsigned long nr_taken,
>> +		int lru,
>> +		unsigned long max_seq,
>> +		int tier,
>> +		unsigned long min_seq),
> 

Thank you for your review.

> Do we need show nid? Guess phone vendor doesn't care about multi-NUMA
> system.
> 

Eh, nid is not an mglru-specific key. Since there are 12 elements here, it can't 
be added here.


> And I checked v1 thread, seems Steven suggested to move the two int to
> avoid extra padding.
> 

Yeah, I will update it. I updated v2 to fix Sashiko's issue, before Steven had 
any comment.


>> +
>> +	TP_ARGS(lruvec, highest_zoneidx, order, nr_requested, nr_scanned,
>> +		nr_sorted, nr_skipped, nr_taken, lru, max_seq, tier, min_seq),
>> +
>> +	TP_STRUCT__entry(
>> +		__field(u64, memcg_id)
>> +		__field(int, highest_zoneidx)
>> +		__field(int, order)
>> +		__field(unsigned long, nr_requested)
>> +		__field(unsigned long, nr_scanned)
>> +		__field(unsigned long, nr_sorted)
>> +		__field(unsigned long, nr_skipped)
>> +		__field(unsigned long, nr_taken)
>> +		__field(int, lru)
>> +		__field(unsigned long, max_seq)
>> +		__field(int, tier)
>> +		__field(unsigned long, min_seq)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->memcg_id = mem_cgroup_id(lruvec_memcg(lruvec));
>> +		__entry->highest_zoneidx = highest_zoneidx;
>> +		__entry->order = order;
>> +		__entry->nr_requested = nr_requested;
>> +		__entry->nr_scanned = nr_scanned;
>> +		__entry->nr_sorted = nr_sorted;
>> +		__entry->nr_skipped = nr_skipped;
>> +		__entry->nr_taken = nr_taken;
>> +		__entry->lru = lru;
>> +		__entry->max_seq = max_seq;
>> +		__entry->tier = tier;
>> +		__entry->min_seq = min_seq;
>> +	),
>> +
>> +	TP_printk("memcg_id=%llu classzone=%d order=%d nr_requested=%lu nr_scanned=%lu nr_sorted=%lu nr_skipped=%lu nr_taken=%lu lru=%s max_seq=%lu tier=%d min_seq=%lu",
>> +		__entry->memcg_id,
>> +		__entry->highest_zoneidx,
>> +		__entry->order,
>> +		__entry->nr_requested,
>> +		__entry->nr_scanned,
>> +		__entry->nr_sorted,
>> +		__entry->nr_skipped,
>> +		__entry->nr_taken,
>> +		__print_symbolic(__entry->lru, LRU_NAMES),
>> +		__entry->max_seq,
>> +		__entry->tier,
>> +		__entry->min_seq)
>> +);
>> +
>>   TRACE_EVENT(mm_vmscan_write_folio,
>>   
>>   	TP_PROTO(struct folio *folio),
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 2554a6513aa8..67f59aa73fb9 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -4876,6 +4876,12 @@ static int scan_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
>>   	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_mglru_scan_folios(lruvec,
>> +				   sc->reclaim_idx, sc->order, nr_to_scan,
>> +				   scanned, sorted, skipped, isolated,
>> +				   type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON,
>> +				   lrugen->max_seq, tier,
>> +				   lrugen->min_seq[type]);
> 
> And seems Steven also suggested to calculate lru, max_seq, min_seq in
> TP_fast_assign() in v1 which could be missed.
> 

Thanks, I will update it following Steven's suggestions.


>          TP_fast_assign(
>                  __entry->memcg_id = mem_cgroup_id(lruvec_memcg(lruvec));
>                  __entry->highest_zoneidx = sc->reclaim_idx;
>                  __entry->order = sc->order;
>                  __entry->nr_requested = nr_requested;
>                  __entry->nr_scanned = nr_scanned;
>                  __entry->nr_sorted = nr_sorted;
>                  __entry->nr_skipped = nr_skipped;
>                  __entry->nr_taken = nr_taken;
>                  __entry->lru = type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON;
>                  __entry->max_seq = lrugen->max_seq;
>                  __entry->tier = tier;
>                  __entry->min_seq = lrugen->min_seq;
>          ),
> 

However, 'sc' is an internal structure, so sc->order cannot be accessed in 
TP_fast_assign(), and I don't think it is worth making scan_control an external 
structure just for this.

> 
>>   
>>   	*isolatedp = isolated;
>>   	return scanned;
>> -- 
>> 2.34.1
>>

-- 
Best regards
Ridong


  reply	other threads:[~2026-09-15 12:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 10:29 [PATCH v2 0/3] mm/mglru: add tracepoints for scan and aging paths Ridong Chen
2026-09-11 10:29 ` [PATCH v2 1/3] mm/mglru: factor out lru_gen_seq_nr_pages() Ridong Chen
2026-09-14  7:09   ` Baolin Wang
2026-09-15  6:32   ` Baoquan He
2026-09-11 10:29 ` [PATCH v2 2/3] mm/mglru: add tracepoint for scan_folios() Ridong Chen
2026-09-14  7:47   ` Baolin Wang
2026-09-14  9:04     ` Ridong Chen
2026-09-15 11:14   ` Baoquan He
2026-09-15 12:17     ` Ridong Chen [this message]
2026-09-16  2:14       ` Baoquan He
2026-09-16 12:17         ` Ridong Chen
2026-09-11 10:29 ` [PATCH v2 3/3] mm/mglru: add tracepoint for inc_max_seq() Ridong Chen
2026-09-14  7:38   ` Baolin Wang

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=e38f2b80-20f2-4787-9e07-fb601552f550@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=chenridong@xiaomi.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=qi.zheng@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®