Skip to content

Commit 3611066

Browse files
committed
perf tools: Cope with differences for lib/list_sort.c copy from the kernel
With 6d74e1e ("tools/lib/list_sort: remove redundant code for cond_resched handling") we need to use the newly added hunk based exceptions when comparing the copy we carry in tools/lib/ to the original file, do it by adding the hunks that we know will be the expected diff. If at some point the original file is updated in other parts, then we should flag and check the file for update. Acked-by: Kuan-Wei Chiu <visitorckw@gmail.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Link: https://lore.kernel.org/lkml/20240930202136.16904-3-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent cd46ea5 commit 3611066

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@@ -1,5 +1,6 @@
2+
// SPDX-License-Identifier: GPL-2.0
3+
#include <linux/kernel.h>
4+
+#include <linux/bug.h>
5+
#include <linux/compiler.h>
6+
#include <linux/export.h>
7+
#include <linux/string.h>
8+
@@ -52,6 +53,7 @@
9+
struct list_head *a, struct list_head *b)
10+
{
11+
struct list_head *tail = head;
12+
+ u8 count = 0;
13+
14+
for (;;) {
15+
/* if equal, take 'a' -- important for sort stability */
16+
@@ -77,6 +79,15 @@
17+
/* Finish linking remainder of list b on to tail */
18+
tail->next = b;
19+
do {
20+
+ /*
21+
+ * If the merge is highly unbalanced (e.g. the input is
22+
+ * already sorted), this loop may run many iterations.
23+
+ * Continue callbacks to the client even though no
24+
+ * element comparison is needed, so the client's cmp()
25+
+ * routine can invoke cond_resched() periodically.
26+
+ */
27+
+ if (unlikely(!++count))
28+
+ cmp(priv, b, b);
29+
b->prev = tail;
30+
tail = b;
31+
b = b->next;

tools/perf/check-headers.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
193193
check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
194194
check include/linux/ctype.h '-I "isdigit("'
195195
check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
196-
check lib/list_sort.c '-I "^#include <linux/bug.h>"'
197196

198197
# diff non-symmetric files
199198
check_2 tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl
@@ -211,6 +210,10 @@ done
211210
check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
212211
check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
213212

213+
# Files with larger differences
214+
215+
check_ignore_some_hunks lib/list_sort.c
216+
214217
cd tools/perf || exit
215218

216219
if [ ${#FAILURES[@]} -gt 0 ]

0 commit comments

Comments
 (0)