On 18/08/2025 06:55, Yafang Shao wrote: > This self-test verifies that PMD-mapped THP allocation is restricted in > page faults for tasks within a specific cgroup, while still permitting > THP allocation via khugepaged. > > Since THP allocation depends on various factors (e.g., system memory > pressure), using the actual allocated THP size for validation is > unreliable. Instead, we check the return value of get_suggested_order(), > which indicates whether the system intends to allocate a THP, regardless of > whether the allocation ultimately succeeds. > > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > --- > tools/testing/selftests/bpf/config | 3 + > .../selftests/bpf/prog_tests/thp_adjust.c | 224 ++++++++++++++++++ > .../selftests/bpf/progs/test_thp_adjust.c | 76 ++++++ > .../bpf/progs/test_thp_adjust_failure.c | 25 ++ > 4 files changed, 328 insertions(+) > create mode 100644 tools/testing/selftests/bpf/prog_tests/thp_adjust.c > create mode 100644 tools/testing/selftests/bpf/progs/test_thp_adjust.c > create mode 100644 tools/testing/selftests/bpf/progs/test_thp_adjust_failure.c > I think would be good to add selftests to make sure the bpf programs are working after fork/exec as intended.