mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 13:05:08 -05:00
Add mlockall and SCHED_FIFO support
The attached patch adds support for mlockall() as well as the SCHED_FIFO real-time scheduler. It should result in reduced (and more consistent) latency. Usage is documented in all the documents.
This commit is contained in:
committed by
Miroslav Lichvar
parent
cdc22df903
commit
35e662d810
36
conf.c
36
conf.c
@@ -93,6 +93,14 @@ static void parse_broadcast(const char *);
|
||||
static void parse_linux_hz(const char *);
|
||||
static void parse_linux_freq_scale(const char *);
|
||||
|
||||
#if defined(HAVE_SCHED_SETSCHEDULER)
|
||||
static void parse_sched_priority(const char *);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MLOCKALL)
|
||||
static void parse_lockall(const char *);
|
||||
#endif
|
||||
|
||||
/* ================================================== */
|
||||
/* Configuration variables */
|
||||
|
||||
@@ -209,6 +217,14 @@ static const Command commands[] = {
|
||||
{"broadcast", 9, parse_broadcast},
|
||||
{"linux_hz", 8, parse_linux_hz},
|
||||
{"linux_freq_scale", 16, parse_linux_freq_scale}
|
||||
#if defined(HAVE_SCHED_SETSCHEDULER)
|
||||
,{"sched_priority", 14, parse_sched_priority}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MLOCKALL)
|
||||
,{"lock_all", 8, parse_lockall}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
static int n_commands = (sizeof(commands) / sizeof(commands[0]));
|
||||
@@ -365,6 +381,26 @@ parse_source(const char *line, NTP_Source_Type type)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
#if defined(HAVE_SCHED_SETSCHEDULER)
|
||||
static void
|
||||
parse_sched_priority(const char *line)
|
||||
{
|
||||
if (SchedPriority == 0) { /* Command-line switch must have priority */
|
||||
sscanf(line, "%d", &SchedPriority);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MLOCKALL)
|
||||
static void
|
||||
parse_lockall(const char *line)
|
||||
{
|
||||
LockAll = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_server(const char *line)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user