summaryrefslogtreecommitdiffstats
path: root/init/init_task.c
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.com>2015-09-07 14:38:38 +0200
committerSteven Rostedt <rostedt@goodmis.org>2015-11-03 16:03:45 -0500
commitf47cb66df2f89dd1f796742c64f9ead77e548a6a (patch)
treef9ea36d78fcff17ba3bbd80c20cf0faa9339432e /init/init_task.c
parent8b46ff6938d2c78a16520a37086944ecbaa8ab8b (diff)
downloadlinux-f47cb66df2f89dd1f796742c64f9ead77e548a6a.tar.gz
linux-f47cb66df2f89dd1f796742c64f9ead77e548a6a.tar.bz2
linux-f47cb66df2f89dd1f796742c64f9ead77e548a6a.zip
ring_buffer: Fix more races when terminating the producer in the benchmark
The commit b44754d8262d3aab8 ("ring_buffer: Allow to exit the ring buffer benchmark immediately") added a hack into ring_buffer_producer() that set @kill_test when kthread_should_stop() returned true. It improved the situation a lot. It stopped the kthread in most cases because the producer spent most of the time in the patched while cycle. But there are still few possible races when kthread_should_stop() is set outside of the cycle. Then we do not set @kill_test and some other checks pass. This patch adds a better fix. It renames @test_kill/TEST_KILL() into a better descriptive @test_error/TEST_ERROR(). Also it introduces break_test() function that checks for both @test_error and kthread_should_stop(). The new function is used in the producer when the check for @test_error is not enough. It is not used in the consumer because its state is manipulated by the producer via the "reader_finish" variable. Also we add a missing check into ring_buffer_producer_thread() between setting TASK_INTERRUPTIBLE and calling schedule_timeout(). Otherwise, we might miss a wakeup from kthread_stop(). Link: http://lkml.kernel.org/r/1441629518-32712-3-git-send-email-pmladek@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'init/init_task.c')
0 files changed, 0 insertions, 0 deletions