Skip to content

Commit

Permalink
perf synthetic-events: Don't sort the task scan result from /proc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Jul 2, 2022
1 parent 5eb502b commit 363afa3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/synthetic-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
snprintf(filename, sizeof(filename), "%s/proc/%d/task",
machine->root_dir, pid);

n = scandir(filename, &dirent, filter_task, alphasort);
n = scandir(filename, &dirent, filter_task, NULL);
if (n < 0)
return n;

Expand Down Expand Up @@ -987,7 +987,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
return 0;

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

Expand Down

0 comments on commit 363afa3

Please sign in to comment.