[PATCH v2 1/2] bpf: Replace sort_r_nonatomic() with sort_r() in check_dup_ids()

From: Kuan-Wei Chiu

Date: Thu Sep 10 2026 - 13:01:25 EST


bpf_kprobe_multi_link_attach() in the same file has been using sort_r()
under the exact same limit (1U << 20) for 4 years without issues.
Switch check_dup_ids() from sort_r_nonatomic() to sort_r() to match it.

This removes the last in-tree user of sort_r_nonatomic(), allowing the
unused _nonatomic() sort variants to be dropped from the core library.

Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
Build test only

kernel/trace/bpf_trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 29260951aa87..1d7e73ddbafb 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -3826,7 +3826,7 @@ static int check_dup_ids(u32 *ids, u64 *cookies, u32 cnt)
* and check it for duplicates. The ids and cookies arrays
* are left sorted.
*/
- sort_r_nonatomic(ids, cnt, sizeof(ids[0]), ids_cmp_r, ids_swap_r, data);
+ sort_r(ids, cnt, sizeof(ids[0]), ids_cmp_r, ids_swap_r, data);

for (int i = 1; i < cnt; i++) {
if (ids[i] == ids[i - 1]) {
--
2.55.0.1003.g10538fe699-goog