All of lore.kernel.org
 help / color / mirror / Atom feed
* + bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids.patch added to mm-nonmm-unstable branch
@ 2026-10-31  2:12 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-10-31  2:12 UTC (permalink / raw)
  To: mm-commits, yonghong.song, song, rostedt, mhiramat, memxor, matt,
	mathieu.desnoyers, martin.lau, marscheng, kpsingh, jserv, jolsa,
	ihor.solodrai, hch, emil, eleanor.lin, eddyz87, daniel, ast,
	andrii, visitorckw, akpm


The patch titled
     Subject: bpf: replace sort_r_nonatomic() with sort_r() in check_dup_ids()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: bpf: replace sort_r_nonatomic() with sort_r() in check_dup_ids()
Date: Thu, 10 Sep 2026 16:52:20 +0000

Patch series "lib/sort: Clean up sort_nonatomic() and sort_r_nonatomic()",
v2.

kernel/trace/bpf_trace.c is the sole remaining user of sort_r_nonatomic().
Switch check_dup_ids() to sort_r() to match
bpf_kprobe_multi_link_attach() in the same file, which has safely used
sort_r() under the same limit (1U << 20) for 4 years.

With no users left in the tree, remove the unused sort_nonatomic() and
sort_r_nonatomic() APIs.  This drops the __sort_r() wrapper and eliminates
the may_schedule branch and cond_resched() from the inner sorting loop.


This patch (of 2):

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.

Link: https://lore.kernel.org/20260910165222.1186628-1-visitorckw@gmail.com
Link: https://lore.kernel.org/20260910165222.1186628-2-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Song Liu <song@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: <matt@bobrowski.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ihor Solodrai <ihor.solodrai@linux.dev>
Cc: <martin.lau@linux.dev>
Cc: Yonghong Song <yonghong.song@linux.dev>
Cc: Emil Tsalapatis <emil@etsalapatis.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: <hch@infradead.org>
Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw>
Cc: Yu-Chun Lin <eleanor.lin@realtek.com>
Cc: <marscheng@google.com>
---

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

--- a/kernel/trace/bpf_trace.c~bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids
+++ a/kernel/trace/bpf_trace.c
@@ -3842,7 +3842,7 @@ static int check_dup_ids(u32 *ids, u64 *
 	 * 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]) {
_

Patches currently in -mm which might be from visitorckw@gmail.com are

bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids.patch
revert-lib-sortc-add-_nonatomic-variants-with-cond_resched.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-31  2:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-31  2:12 + bpf-replace-sort_r_nonatomic-with-sort_r-in-check_dup_ids.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.