File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1717# 13-Jan-2016 Allan McAleavy run pep8 against program
1818# 02-Feb-2019 Brendan Gregg Column shuffle, bring back %ratio
1919# 15-Feb-2023 Rong Tao Add writeback_dirty_{folio,page} tracepoints
20+ # 17-Nov-2024 Rocky Xing Added filemap_add_folio/folio_mark_accessed kprobes
2021
2122from __future__ import print_function
2223from bcc import BPF
@@ -118,8 +119,14 @@ def get_meminfo():
118119
119120# load BPF program
120121b = BPF (text = bpf_text )
121- b .attach_kprobe (event = "add_to_page_cache_lru" , fn_name = "do_count_apcl" )
122- b .attach_kprobe (event = "mark_page_accessed" , fn_name = "do_count_mpa" )
122+ if BPF .get_kprobe_functions (b'filemap_add_folio' ):
123+ b .attach_kprobe (event = "filemap_add_folio" , fn_name = "do_count_apcl" )
124+ else :
125+ b .attach_kprobe (event = "add_to_page_cache_lru" , fn_name = "do_count_apcl" )
126+ if BPF .get_kprobe_functions (b'folio_mark_accessed' ):
127+ b .attach_kprobe (event = "folio_mark_accessed" , fn_name = "do_count_mpa" )
128+ else :
129+ b .attach_kprobe (event = "mark_page_accessed" , fn_name = "do_count_mpa" )
123130
124131# Function account_page_dirtied() is changed to folio_account_dirtied() in 5.15.
125132# Both folio_account_dirtied() and account_page_dirtied() are
Original file line number Diff line number Diff line change 1313# 13-Jul-2016 Emmanuel Bretelle first version
1414# 17-Mar-2022 Rocky Xing Added PID filter support.
1515# 15-Feb-2023 Rong Tao Add writeback_dirty_{folio,page} tracepoints
16+ # 17-Nov-2024 Rocky Xing Added filemap_add_folio/folio_mark_accessed kprobes
1617
1718from __future__ import absolute_import
1819from __future__ import division
@@ -206,8 +207,14 @@ def handle_loop(stdscr, args):
206207 bpf_text = bpf_text .replace ('FILTER_PID' , '0' )
207208
208209 b = BPF (text = bpf_text )
209- b .attach_kprobe (event = "add_to_page_cache_lru" , fn_name = "do_count_apcl" )
210- b .attach_kprobe (event = "mark_page_accessed" , fn_name = "do_count_mpa" )
210+ if BPF .get_kprobe_functions (b'filemap_add_folio' ):
211+ b .attach_kprobe (event = "filemap_add_folio" , fn_name = "do_count_apcl" )
212+ else :
213+ b .attach_kprobe (event = "add_to_page_cache_lru" , fn_name = "do_count_apcl" )
214+ if BPF .get_kprobe_functions (b'folio_mark_accessed' ):
215+ b .attach_kprobe (event = "folio_mark_accessed" , fn_name = "do_count_mpa" )
216+ else :
217+ b .attach_kprobe (event = "mark_page_accessed" , fn_name = "do_count_mpa" )
211218 b .attach_kprobe (event = "mark_buffer_dirty" , fn_name = "do_count_mbd" )
212219
213220 # Function account_page_dirtied() is changed to folio_account_dirtied() in 5.15.
You can’t perform that action at this time.
0 commit comments