lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160225090840.GB6357@twins.programming.kicks-ass.net>
Date:	Thu, 25 Feb 2016 10:08:40 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:	Linux PM list <linux-pm@...r.kernel.org>,
	Juri Lelli <juri.lelli@....com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
	Steve Muckle <steve.muckle@...aro.org>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [RFC/RFT][PATCH v3 2/2] cpufreq: schedutil: Switching
 frequencies from interrupt context

On Thu, Feb 25, 2016 at 12:30:43AM +0100, Rafael J. Wysocki wrote:
> +unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
> +				      unsigned int target_freq)
> +{
> +	struct acpi_cpufreq_data *data = policy->driver_data;
> +	struct cpufreq_frequency_table *entry;
> +	struct acpi_processor_performance *perf;
> +	unsigned int uninitialized_var(next_perf_state);
> +	unsigned int uninitialized_var(next_freq);
> +	unsigned int best_diff;
> +
> +	for (entry = data->freq_table, best_diff = UINT_MAX;
> +	     entry->frequency != CPUFREQ_TABLE_END; entry++) {
> +		unsigned int diff, freq = entry->frequency;
> +
> +		if (freq == CPUFREQ_ENTRY_INVALID)
> +			continue;
> +
> +		diff = abs(freq - target_freq);

Why would you consider frequencies that are below where you want to be?

> +		if (diff >= best_diff)
> +			continue;
> +
> +		best_diff = diff;
> +		next_perf_state = entry->driver_data;
> +		next_freq = freq;
> +		if (best_diff == 0)
> +			goto found;
> +	}
> +	if (best_diff == UINT_MAX)
> +		return CPUFREQ_ENTRY_INVALID;
> +
> + found:
> +	perf = to_perf_data(data);
> +	if (perf->state == next_perf_state) {
> +		if (unlikely(data->resume))
> +			data->resume = 0;
> +		else
> +			return next_freq;
> +	}
> +
> +	data->cpu_freq_fast_write(perf->states[next_perf_state].control);
> +	perf->state = next_perf_state;
> +	return next_freq;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ