Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from tzachiabo/patch-1
Browse files Browse the repository at this point in the history
fixed bpf probe build on kernel >= 6.2
  • Loading branch information
vbatts authored Oct 3, 2023
2 parents 79ac5bb + 781914c commit 315f24d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion driver/bpf/fillers.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,13 @@ static __always_inline unsigned long bpf_get_mm_counter(struct mm_struct *mm,
int member)
{
long val;


// See 6.2 kernel commit: https://github.com/torvalds/linux/commit/f1a7941243c102a44e8847e3b94ff4ff3ec56f25
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
bpf_probe_read(&val, sizeof(val), &mm->rss_stat.count[member]);
#else
bpf_probe_read_kernel(&val, sizeof(val), &mm->rss_stat[member].count);
#endif
if (val < 0)
val = 0;

Expand Down

0 comments on commit 315f24d

Please sign in to comment.