Skip to content
This repository was archived by the owner on Sep 11, 2019. It is now read-only.

Commit adc6257

Browse files
olsajiriacmel
authored andcommittedApr 17, 2019
perf evlist: Fix side band thread draining
Current perf_evlist__poll_thread() code could finish without draining the data. Adding the logic that makes sure we won't finish before the drain. Signed-off-by: Jiri Olsa <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Fixes: 657ee55 ("perf evlist: Introduce side band thread") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a93e0b2 commit adc6257

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
 

‎tools/perf/util/evlist.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -1868,12 +1868,12 @@ static void *perf_evlist__poll_thread(void *arg)
18681868
{
18691869
struct perf_evlist *evlist = arg;
18701870
bool draining = false;
1871-
int i;
1871+
int i, done = 0;
1872+
1873+
while (!done) {
1874+
bool got_data = false;
18721875

1873-
while (draining || !(evlist->thread.done)) {
1874-
if (draining)
1875-
draining = false;
1876-
else if (evlist->thread.done)
1876+
if (evlist->thread.done)
18771877
draining = true;
18781878

18791879
if (!draining)
@@ -1894,9 +1894,13 @@ static void *perf_evlist__poll_thread(void *arg)
18941894
pr_warning("cannot locate proper evsel for the side band event\n");
18951895

18961896
perf_mmap__consume(map);
1897+
got_data = true;
18971898
}
18981899
perf_mmap__read_done(map);
18991900
}
1901+
1902+
if (draining && !got_data)
1903+
break;
19001904
}
19011905
return NULL;
19021906
}

0 commit comments

Comments
 (0)
This repository has been archived.