13
0

Raise the butler's I/O priority

This likely won't make much difference on modern systems,
since it requires a kernel based I/O scheduler. which is
disabled (set to "none" for NVMe and SSDs).
This commit is contained in:
Robin Gareus 2024-04-29 21:46:06 +02:00
parent e90e31d682
commit 2af2df3516
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 23 additions and 1 deletions

View File

@ -24,6 +24,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_IOPRIO
#include <sys/syscall.h>
#endif
#ifndef PLATFORM_WINDOWS #ifndef PLATFORM_WINDOWS
#include <poll.h> #include <poll.h>
#endif #endif
@ -177,6 +181,13 @@ Butler::thread_work ()
bool disk_work_outstanding = false; bool disk_work_outstanding = false;
RouteList::iterator i; RouteList::iterator i;
#ifdef HAVE_IOPRIO
// ioprio_set (IOPRIO_WHO_PROCESS, 0 /*calling thread*/, IOPRIO_PRIO_VALUE (IOPRIO_CLASS_RT, 4))
if (0 != syscall (SYS_ioprio_set, 1, 0, (1 << 13) | 4)) {
warning << _("Cannot set I/O Priority for disk read/write thread") << endmsg;
}
#endif
while (true) { while (true) {
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler main loop, disk work outstanding ? %2 @ %3\n", DEBUG_THREAD_SELF, disk_work_outstanding, g_get_monotonic_time ())); DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler main loop, disk work outstanding ? %2 @ %3\n", DEBUG_THREAD_SELF, disk_work_outstanding, g_get_monotonic_time ()));

View File

@ -345,9 +345,19 @@ def configure(conf):
conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False) conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False) conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False) conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
have_sys_ioprio = conf.check_cc(
msg="Checking for 'ioprio_set' syscall support",
features = 'c',
mandatory = False,
execute = False,
fragment = "#include <sys/syscall.h>\nint main () { syscall(SYS_ioprio_set, 1, 0, 8192); return 0; }")
if have_sys_ioprio:
conf.define('HAVE_IOPRIO', 1)
conf.env['HAVE_IOPRIO'] = True
conf.write_config_header('libardour-config.h', remove=False) conf.write_config_header('libardour-config.h', remove=False)
# Boost headers # Boost headers

View File

@ -1571,6 +1571,7 @@ const char* const ardour_config_info = "\\n\\
write_config_text('Futex Semaphore', conf.is_defined('USE_FUTEX_SEMAPHORE')) write_config_text('Futex Semaphore', conf.is_defined('USE_FUTEX_SEMAPHORE'))
write_config_text('Freedesktop files', opts.freedesktop) write_config_text('Freedesktop files', opts.freedesktop)
write_config_text('G_ENABLE_DEBUG', opts.gdebug or conf.env['DEBUG']) write_config_text('G_ENABLE_DEBUG', opts.gdebug or conf.env['DEBUG'])
write_config_text('I/O Priorty Set', conf.is_defined('HAVE_IOPRIO'))
write_config_text('Libjack linking', conf.env['libjack_link']) write_config_text('Libjack linking', conf.env['libjack_link'])
write_config_text('Libjack metadata', conf.is_defined ('HAVE_JACK_METADATA')) write_config_text('Libjack metadata', conf.is_defined ('HAVE_JACK_METADATA'))
write_config_text('Lua Binding Doc', conf.is_defined('LUABINDINGDOC')) write_config_text('Lua Binding Doc', conf.is_defined('LUABINDINGDOC'))