diff options
author | Jiri Olsa | 2018-11-05 21:23:40 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo | 2018-12-17 14:58:03 -0300 |
commit | 94ad6e7e3606454498aeac1fdd1b9de5c1e6735a (patch) | |
tree | 00954eb7ea985e5053f7c1b53fc9c419a1316d4e /lib/bch.c | |
parent | 16c66bc167cc52992f66748aed7ac21396189457 (diff) |
perf top: Use cond variable instead of a lock
Use conditional variable logic to synchronize between the reading and
processing threads. Currently it's done by having mutex around rotation
code.
Using a POSIX cond variable to sync both threads after queues rotation:
Process thread:
- Detects data
- Switches queues
- Sets rotate variable
- Waits in pthread_cond_wait()
Read thread:
- Detects rotate is set
- Kicks the process thread with a pthread_cond_signal()
After this rotation is safely completed and both threads can continue
with the new queue.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-3rdeg23rv3brvy1pwt3igvyw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'lib/bch.c')
0 files changed, 0 insertions, 0 deletions