File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1313# When copying or porting, include this comment.
1414#
1515# 03-Jul-2019 Brendan Gregg Ported from bpftrace to BCC.
16+ # 31-May-2024 Rong Tao Support folio
1617
1718from __future__ import print_function
1819from bcc import BPF
4647
4748BPF_HASH(counts, struct key_t, u64);
4849
49- int kprobe__swap_readpage (struct pt_regs *ctx)
50+ int trace_swap_read (struct pt_regs *ctx)
5051{
5152 u64 *val, zero = 0;
5253 u32 tgid = bpf_get_current_pid_tgid() >> 32;
6667htab_batch_ops = True if BPF .kernel_struct_has_field (b'bpf_map_ops' ,
6768 b'map_lookup_and_delete_batch' ) == 1 else False
6869
70+ if b .get_kprobe_functions (b"swap_readpage" ):
71+ b .attach_kprobe (event = "swap_readpage" , fn_name = "trace_swap_read" )
72+ elif b .get_kprobe_functions (b"swap_read_folio" ):
73+ b .attach_kprobe (event = "swap_read_folio" , fn_name = "trace_swap_read" )
74+ else :
75+ print ("ERROR: swap_readpage() and swap_read_folio() kernel function"
76+ " not found or traceable. "
77+ "The kernel might be too old or the the function has been inlined." )
78+ exit ()
79+
6980print ("Counting swap ins. Ctrl-C to end." );
7081
7182# output
You can’t perform that action at this time.
0 commit comments