CPU policy learning: Advantages and Disadvantages of interactive policies

Source: Internet
Author: User
CPU policy learning: Advantages and Disadvantages of interactive policies

I believe that people who study CPU policies often listen to others or say that each strategy has both good and bad performance and power consumption, and the power consumption with good performance is high, reducing Power Consumption sacrifices performance.

Is that true?

Even if it is true, why ??

Next we will find the advantages and disadvantages of the interactive strategy during the learning process, think about the methods for improvement, and then come to ponder over these old ideas.

Main features:

Frequency increase: Large

Increase speed: fast

Frequency increase accuracy: Average

Frequency reduction: Large

Frequency reduction speed: Average

Frequency reduction accuracy: Average

Accuracy indicates whether or not the system can maintain the frequency after a frequency adjustment is most suitable for the current system load for a period of time.

A good degree of accuracy indicates that the system runs for a certain period of time at a certain frequency point after one frequency modulation, with fewer frequency modulation times.

The accuracy difference indicates that after one frequency modulation, the system will soon frequency again, with many frequency modulation times

As for the explanation of Appeal features, the previous blog post combined with actual code analysis. For more information, see CPU policy learning: Interactive Analysis and code analysis.

In addition to the above features, this policy has a particularly prominent problem.

Because this policy is based on a timer, it constantly calculates the load of the system during a timer period and obtains the load value. Based on some algorithms, it determines whether the frequency is adjusted and how the frequency is adjusted.

Therefore, the cycle size of the timer is critical. Can the average value of a cycle reflect the system's frequency requirements, this algorithm determines the frequency of the system in the next cycle based on the results of a timer cycle before the current time. That is to say, we can guess the requirements of the next cycle based on the previous requirements; as you can imagine, for the system, the requirements for these two cycles may be completely different, and such an algorithm will appear "self-intelligence" and "self-Passion "; in addition, during a short period of time from low load to high load (the size of a timer cycle), the system runs high load tasks at low frequency.

Typical scenarios include:

Input (touch keypad)

Music Play

Local vedio play

In general, these scenarios do not require high system running frequency, but only need low or low frequency, but cannot quickly respond to system requirements.

For the input scenario, the android development code has been taken into consideration, and the analysis is as follows:

The registration of the Input System registers "device" and "handlers". In the bus directory, the input system uses a linked list to support handler storage to support one service interface that interrupts multiple services, when an input response is required, you only need to call the registration interface provided by input to add a handle under handlers.

input_register_handler(&cpufreq_interactive_input_handler);

static struct input_handler cpufreq_interactive_input_handler = {.event          = cpufreq_interactive_input_event,.connect        = cpufreq_interactive_input_connect,.disconnect     = cpufreq_interactive_input_disconnect,.name           = "cpufreq_interactive",.id_table       = cpufreq_interactive_ids,};

In the handler method set, the event method is used to respond to specific events. Connect is used to connect the handle to the input system.

static void cpufreq_interactive_input_event(struct input_handle *handle,    unsigned int type,    unsigned int code, int value){if (input_boost_val && type == EV_SYN && code == SYN_REPORT) {trace_cpufreq_interactive_boost("input");cpufreq_interactive_boost();}}

The judgment conditions here have two aspects:

1. input_boost_val is a global variable for the user interface, which can be switched at any time through the device Node

2. type = ev_syn & code = syn_report indicates the input_sync action, including the sync of press and release actions.

If these two conditions are met, the CPU freq_interactive_boost

Cpufreq_interactive_boost: as the name suggests, it is interactive's handling of burst tasks. A sudden task is that the system suddenly has a high demand for a short period of time without a task, and this requirement may be very short, and the system must respond at any time. It cannot be determined after timer has determined it. Input music local vedio

Static void cpufreq_interactive_boost (void) {int I; int anyboost = 0; unsigned long flags; struct success * pcpu; spin_lock_irqsave (& up_cpumask_lock, flags); wait (I) {pcpu = & per_cpu (cpuinfo, I); // core code: if the frequency is lower than hispeed_freq, it is immediately increased to hispeed_freq
If (pcpu-> target_freq 

In general, this strategy is not bad. The frequency reduction and frequency reduction are bold and advanced in terms of performance. However, there are many improvements in frequency switching.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.