Skip to content

Commit f94fe92

Browse files
committed
Remove pids map from LFU policy
1 parent 9a5d3b6 commit f94fe92

2 files changed

Lines changed: 11 additions & 28 deletions

File tree

policies/cache_ext_sampling.bpf.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ char _license[] SEC("license") = "GPL";
3131
* Maps
3232
*/
3333

34-
struct {
35-
__uint(type, BPF_MAP_TYPE_HASH);
36-
__type(key, int);
37-
__type(value, bool);
38-
__uint(max_entries, 100);
39-
} scan_pids SEC(".maps");
40-
4134
#define MAX_PAGES (1 << 20)
4235

4336
struct folio_metadata {

policies/cache_ext_sampling.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,35 +114,25 @@ int main(int argc, char **argv)
114114
ret = initialize_watch_dir_map(args.watch_dir,
115115
bpf_map__fd(skel->maps.inode_watchlist), false);
116116

117-
// Pin scan_pids map
118-
ret = bpf_map__pin(skel->maps.scan_pids, "/sys/fs/bpf/cache_ext/scan_pids");
119-
if (ret < 0) {
120-
perror("Failed to pin scan_pids map");
121-
goto cleanup;
122-
}
123-
124-
// Attach cache_ext_ops to the specific cgroup
125-
link = bpf_map__attach_cache_ext_ops(skel->maps.sampling_ops, cgroup_fd);
126-
if (link == NULL) {
117+
// Attach cache_ext_ops to the specific cgroup
118+
link =
119+
bpf_map__attach_cache_ext_ops(skel->maps.sampling_ops, cgroup_fd);
120+
if (link == NULL) {
127121
perror("Failed to attach BPF cache_ext_ops to cgroup");
128-
goto cleanup_unpin;
129-
}
122+
goto cleanup;
123+
}
130124

131-
// Attach probes
132-
ret = cache_ext_sampling_bpf__attach(skel);
125+
// Attach probes
126+
ret = cache_ext_sampling_bpf__attach(skel);
133127
if (ret) {
134128
perror("Failed to attach BPF programs");
135-
goto cleanup_unpin;
136-
}
129+
goto cleanup;
130+
}
137131

138-
// Wait for keyboard input
132+
// Wait for keyboard input
139133
printf("Press any key to exit...\n");
140134
getchar();
141135

142-
cleanup_unpin:
143-
if (bpf_map__unpin(skel->maps.scan_pids, "/sys/fs/bpf/cache_ext/scan_pids") < 0)
144-
perror("Failed to unpin scan_pids map");
145-
146136
cleanup:
147137
close(cgroup_fd);
148138
bpf_link__destroy(link);

0 commit comments

Comments
 (0)