]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: test-drivers: vivid: don't call schedule in loop
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 9 Dec 2024 15:00:16 +0000 (16:00 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 18 Feb 2025 07:11:36 +0000 (08:11 +0100)
commite4740118b752005cbed339aec9a1d1c43620e0b9
treeb4e9d115b175386af54ef432c65f47a479a032d1
parent2a1551665a8505150cf3f35f6028d7d06ea62024
media: test-drivers: vivid: don't call schedule in loop

Artem reported that the CPU load was 100% when capturing from
vivid at low resolution with ffmpeg.

This was caused by:

while (time_is_after_jiffies(cur_jiffies + wait_jiffies) &&
       !kthread_should_stop())
        schedule();

If there are no other processes running that can be scheduled,
then this is basically a busy-loop.

Change it to wait_event_interruptible_timeout() which doesn't
have that problem.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reported-by: Artem S. Tashkinov <aros@gmx.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219570
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/test-drivers/vivid/vivid-kthread-cap.c
drivers/media/test-drivers/vivid/vivid-kthread-out.c
drivers/media/test-drivers/vivid/vivid-kthread-touch.c
drivers/media/test-drivers/vivid/vivid-sdr-cap.c