We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4941 - ALSA: excessive IO causes high CPU usage
Summary: ALSA: excessive IO causes high CPU usage
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 1.2
Hardware: All Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-13 18:08 UTC by Paul Cercueil
Modified: 2020-06-24 22:30 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix the issue (1.75 KB, text/plain)
2020-01-13 18:08 UTC, Paul Cercueil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Cercueil 2020-01-13 18:08:12 UTC
Created attachment 4157 [details]
Patch to fix the issue

Quote from the patch:

"On GCW Zero jz4770 platform, I saw higher than usual CPU usage when
running a more recent kernel (4.xx series versus 3.xx). Upon
investigation, it was found that the ALSA pcm file was not blocking
as it should. This resulted in ~30-50,000 system calls a second that
were unnecesary.

After adjusting the order in which SDL requests its pcm blocking mode,
the number of syscalls a second has dropped to a much smaller figure,
< 1,000/sec if I recall correctly. CPU usage also dropped by ~5%."
Comment 1 Ryan C. Gordon 2020-03-23 02:04:35 UTC
Generally we don't mess with SDL 1.2, but this patch was straightforward enough that I've applied it to revision control here: https://hg.libsdl.org/SDL/rev/9c0fc6e28c5e

--ryan.
Comment 2 Ozkan Sezer 2020-06-24 22:30:11 UTC
Does the default/2.0 branch not need this change?