> selftests/bpf: Test uprobes and fork() with busy mmap_lock

TL;DR: Nit only, in the new uprobe_busy_mm selftest: the local now_ns() helper
duplicates the existing get_time_ns() from testing_helpers.h and could be
dropped.

> diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_busy_mm.c 
> b/tools/testing/selftests/bpf/prog_tests/uprobe_busy_mm.c
> new file mode 100644
> index 000000000000..30614e8b92cd
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_busy_mm.c

[ ... ]

> +static __u64 now_ns(void)
> +{
> +     struct timespec ts;
> +
> +     clock_gettime(CLOCK_MONOTONIC, &ts);
> +     return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
> +}

This isn't a bug, but could this use the existing get_time_ns() from
testing_helpers.h instead of a local now_ns() copy?

Both read CLOCK_MONOTONIC and return tv_sec * 1000000000 + tv_nsec as a
__u64.  test_progs.h already includes testing_helpers.h, so get_time_ns() is
in scope here, and now_ns() is called about ten times in this file.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/39710454342

Reply via email to