Hello, In numa.c and rt_stall.c, the assertions check for SCX_EXIT_NONE — i.e. the scheduler ran without error. bpf_link__destroy() triggers unregistration which changes uei.kind to SCX_EXIT_UNREG, so moving it before the assertions would make them always fail. Did you run the selftests after this patch? A simpler approach would be using __attribute__((cleanup())) to auto-destroy the link on any return path: static inline void autolink_destroy(struct bpf_link **linkp) { if (*linkp) bpf_link__destroy(*linkp); } #define __autolink __attribute__((cleanup(autolink_destroy))) Then each test just does: struct bpf_link *link __autolink = bpf_map__attach_struct_ops(...); No reordering needed — the link auto-destroys on any return, including early returns from assertion failures. Thanks. -- tejun