Skip to content

Commit 363afa3

Browse files
namhyungacmel
authored andcommitted
perf synthetic-events: Don't sort the task scan result from /proc
It should not sort the result as procfs already returns a proper ordering of tasks. Actually sorting the order caused problems that it doesn't guararantee to process the main thread first. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20220701205458.985106-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 5eb502b commit 363afa3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/perf/util/synthetic-events.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
754754
snprintf(filename, sizeof(filename), "%s/proc/%d/task",
755755
machine->root_dir, pid);
756756

757-
n = scandir(filename, &dirent, filter_task, alphasort);
757+
n = scandir(filename, &dirent, filter_task, NULL);
758758
if (n < 0)
759759
return n;
760760

@@ -987,7 +987,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
987987
return 0;
988988

989989
snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
990-
n = scandir(proc_path, &dirent, filter_task, alphasort);
990+
n = scandir(proc_path, &dirent, filter_task, NULL);
991991
if (n < 0)
992992
return err;
993993

0 commit comments

Comments
 (0)