sys: drop frequency scaling in Linux driver

Since the kernel USER_HZ constant was introduced and the internal HZ
can't be reliably detected in user-space, the frequency scaling constant
used with older kernels is just a random guess.

Remove the scaling completely and let the closed loop compensate for the
error. To prevent thrashing between two states when the system's
frequency error is close to a multiple of USER_HZ, stick to the current
tick value if it's next to the new required tick. This is used only on
archs where USER_HZ is 100 as the frequency adjustment is limited to 500
ppm.

The linux_hz and linux_freq_scale directives are no longer supported,
but allowed by the config parser.
This commit is contained in:
Miroslav Lichvar
2014-05-22 16:28:20 +02:00
parent 14687d003d
commit e147f2f11e
4 changed files with 45 additions and 164 deletions

32
conf.c
View File

@@ -187,16 +187,6 @@ static char *tempcomp_file = NULL;
static double tempcomp_interval;
static double tempcomp_T0, tempcomp_k0, tempcomp_k1, tempcomp_k2;
/* Boolean for whether the Linux HZ value has been overridden, and the
* new value. */
static int set_linux_hz = 0;
static int linux_hz;
/* Boolean for whether the Linux frequency scaling value (i.e. the one that's
* approx (1<<SHIFT_HZ)/HZ) has been overridden, and the new value. */
static int set_linux_freq_scale = 0;
static double linux_freq_scale;
static int sched_priority = 0;
static int lock_memory = 0;
@@ -396,9 +386,9 @@ CNF_ParseLine(const char *filename, int number, char *line)
} else if (!strcasecmp(command, "leapsectz")) {
parse_string(p, &leapsec_tz);
} else if (!strcasecmp(command, "linux_freq_scale")) {
set_linux_freq_scale = parse_double(p, &linux_freq_scale);
LOG(LOGS_WARN, LOGF_Configure, "%s directive is no longer supported", command);
} else if (!strcasecmp(command, "linux_hz")) {
set_linux_hz = parse_int(p, &linux_hz);
LOG(LOGS_WARN, LOGF_Configure, "%s directive is no longer supported", command);
} else if (!strcasecmp(command, "local")) {
parse_local(p);
} else if (!strcasecmp(command, "lock_all")) {
@@ -1616,24 +1606,6 @@ CNF_GetLeapSecTimezone(void)
/* ================================================== */
void
CNF_GetLinuxHz(int *set, int *hz)
{
*set = set_linux_hz;
*hz = linux_hz;
}
/* ================================================== */
void
CNF_GetLinuxFreqScale(int *set, double *freq_scale)
{
*set = set_linux_freq_scale;
*freq_scale = linux_freq_scale ;
}
/* ================================================== */
int
CNF_GetSchedPriority(void)
{