WO2011150792A1 - 一种实现cpu节能的方法及装置 - Google Patents

一种实现cpu节能的方法及装置 Download PDF

Info

Publication number
WO2011150792A1
WO2011150792A1 PCT/CN2011/074866 CN2011074866W WO2011150792A1 WO 2011150792 A1 WO2011150792 A1 WO 2011150792A1 CN 2011074866 W CN2011074866 W CN 2011074866W WO 2011150792 A1 WO2011150792 A1 WO 2011150792A1
Authority
WO
WIPO (PCT)
Prior art keywords
thread
cpu
frequency
domain
triggers
Prior art date
Application number
PCT/CN2011/074866
Other languages
English (en)
French (fr)
Inventor
古忠华
李力
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2011150792A1 publication Critical patent/WO2011150792A1/zh
Priority to US13/904,461 priority Critical patent/US9377842B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/324Power saving characterised by the action undertaken by lowering clock frequency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5094Allocation of resources, e.g. of the central processing unit [CPU] where the allocation takes into account power or heat criteria
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the invention relates to a method and a device for realizing energy saving of a CPU, in particular to a method and a device for realizing energy saving of a CPU in a multi-core system mode.
  • a typical telecommunications environment is a set of boards in a group of chassis. Each board has multiple running entities. These entities can be CPUs, cores, VCPUs, or hyper-threads (logical cores). A CPU can have multiple cores, and a core can have one or more hard threads. An OS (Operation System, operating system) instances are deployed to one or more running entities.
  • the CPU power saving can be achieved by adjusting the frequency step by step to achieve low frequency to reduce power consumption.
  • OS instances mainly include SMP (Symmetric) Multiprocessing, symmetric multiprocessor) and AMP (Asymmetric Multiprocessing, asymmetric multiprocessor).
  • SMP Symmetric
  • AMP Asymmetric Multiprocessing, asymmetric multiprocessor
  • the OS instance can manage all CPU cores at the same time, and can monitor the CPU occupancy rate regularly. When it is found that the CPU frequency is too high or too low, the CPU frequency can be adjusted to achieve energy saving.
  • the multi-core system for AMP deployment mode and the multi-core system with AMP and SMP hybrid deployment mode the main features are: running multiple operating system instances in one domain, each OS instance can independently control its own CPU frequency, All hard threads in a domain share the same CPU frequency. If multiple OS instances are running in a domain, a conflict occurs when each OS instance goes to control the CPU frequency.
  • Embodiments of the present invention provide a method and apparatus for implementing CPU power saving, which can synchronize CPU frequency values in a multi-core system to achieve energy saving of the CPU.
  • a method of implementing CPU power saving including:
  • a device for realizing CPU energy saving comprising:
  • a domain obtaining unit configured to acquire a CPU occupation rate of a thread that triggers frequency tuning in each domain and a domain to which it belongs;
  • a frequency calculation unit configured to calculate a CPU target frequency that needs to be adjusted according to a CPU occupancy rate of the thread that triggers the frequency adjustment obtained by the domain acquisition unit in a domain to which the thread that triggers the frequency modulation belongs;
  • a frequency adjustment unit configured to calculate a timer parameter according to the CPU target frequency obtained by the frequency calculation unit, and set a CPU frequency value of the thread that triggers the frequency modulation.
  • the technical solution provided by the embodiment of the present invention can synchronize the CPU frequency value of the thread in each domain according to the CPU occupancy rate of each thread that triggers the frequency modulation, and then synchronize the CPU frequency value in the multi-core system. Thereby achieving energy saving of the CPU.
  • FIG. 1 is a schematic structural diagram of a hybrid deployment mode of AMP and SMP according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a method for implementing CPU energy saving in a multi-core system mode according to an embodiment of the present invention
  • FIG. 3 is a timing diagram of initializing a configuration CpuFreq1 thread according to an embodiment of the present invention
  • FIG. 4 is a timing diagram of calculating a CPU target frequency by a CPUFreq1 thread according to an embodiment of the present invention
  • FIG. 5 is a timing diagram of adjusting a CPU frequency of a CpuGover 1.1 trigger FM process according to an embodiment of the present invention
  • FIG. 6 is a timing diagram of adjusting a CPU frequency of a CpuGover 1.2 trigger FM process according to an embodiment of the present invention
  • FIG. 7 is a timing diagram of adjusting a CPU frequency of a CpuGover 2.1 trigger FM process according to an embodiment of the present invention.
  • FIG. 8 is a timing diagram of adjusting a CPU frequency of a CpuGover 2.2 trigger FM process according to an embodiment of the present invention
  • FIG. 9 is a timing diagram of adjusting a CPU frequency of a CpuGover3 trigger FM process according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of an apparatus for implementing energy saving of a CPU according to an embodiment of the present invention.
  • An embodiment of the present invention provides a method for implementing CPU power saving, including acquiring a CPU occupation rate of a thread that triggers frequency modulation in each domain and a domain to which it belongs; in the domain to which the thread that triggers the frequency modulation belongs, The CPU occupancy rate of the thread that triggers the frequency modulation calculates a CPU target frequency that needs to be adjusted; calculates a timer parameter according to the CPU target frequency and sets a CPU frequency value of the thread that triggers the frequency modulation.
  • Figure 1 shows a multi-core system with a mixed deployment mode of AMP and SMP. The dark circles and light circles represent the cores with the same physical properties.
  • the core is used as a natural domain (dark for domain 1, shallow)
  • the color is domain 2) because all hard threads in the domain share the same CPU frequency.
  • each OS instance has a hard thread CpuFreq, and CpuFreq creates a cpuGover thread according to the number of cross-domains, thus having the following relationship:
  • OS1 includes CpuFreq1, and CpuFreq1 includes CpuGover1.1 (including pthread1, 3, and 4, belonging to domain 1) and CpuGover1.2 (including pthread6 and 7, belonging to domain 2);
  • OS2 includes CpuFreq2, and CpuFreq2 includes CpuGover2.1 (including pthread2, which belongs to domain 1) and CpuGover2.2 (including pthread5, which belongs to domain 2);
  • OS3 includes CpuFreq3, and CpuFreq3 includes CpuGover3 (including pthread8, which belongs to domain 2).
  • CpuGover thread is mainly responsible for the monitoring and acquisition of CPU occupancy, and then reported to its own manager CpuFreq, CpuGover does not have a distributed concept, can only see itself in an OS instance, can not see other Gover inside the OS instance, also Cannot see the Gover of other OS instances.
  • CpuFreq is responsible for collecting the CPU occupancy rate, and then analyzing and processing the CPU occupancy rate; and processing the result synchronization to the main CpuFreq, each CpuFreq itself adjusts the timer parameters, and finally the frequency is set by the main CpuFreq.
  • the processing for the CPU occupancy rate is to select an appropriate CPU occupancy rate according to the configured policy in multiple CPU occupancy values, and then the hardware support feature sets the frequency update timer parameter to ensure that the time and frequency are consistent.
  • the method may specifically include:
  • Step 21 initializing the configuration hard thread CpuFreq.
  • the identity determination and deployment of the CpuFreq is completed through configuration.
  • the configuration information includes public information and private information.
  • the public information is the ID of all domains on the board and the location information of the CpuFreq of each domain.
  • the private information is the domain feature of the OS. .
  • the configured CpuFreq can create a CpuGover instance. Because it supports dynamic creation, CpuFreq needs to clear the original CpuGover, register a new CpuGover, and start monitoring the thread.
  • CpuFreq1 first logs out the original cpu.
  • Governor and stop the original cpu gover thread then register a new cpu gover and create a cpu gover instance in the domain and create cpu Gover thread, the created thread includes CpuGover1.1 and CpuGover1.2, and the monitoring of each thread is started after the thread is created.
  • Step 22 Obtain the CPU occupation rate of the thread that triggers the frequency modulation in each domain and the domain to which it belongs.
  • CpuGover can be divided into the bottom layer, and CpuFreq can be divided into upper layers.
  • OS instance there may be multiple instances in the bottom layer, and the upper layer aggregates multiple instances into one hard thread.
  • a timer is set for each thread, and the step size of the timer can be based on the CPU update rate.
  • CpuFreq1 records the CPU occupancy of each thread and obtains the domain to which the corresponding thread belongs according to the configuration information of each thread.
  • a threshold value can be set.
  • the CPUGover reports the CPU occupancy rate to the CPUFreq.
  • the CPU occupancy rate changes less than the threshold value, The CPU occupancy rate is not reported to reduce unnecessary message traffic.
  • Step 23 Calculate a CPU target frequency that needs to be adjusted according to a CPU occupancy rate of the thread that triggers the frequency modulation in a domain to which the thread that triggers the frequency modulation belongs.
  • the thread with the highest CPU occupancy rate is first selected for processing, and the timer parameters of the OS instance are calculated. If CpuFreq cannot obtain the information of the domain's main CpuFreq, it will be processed according to the highest frequency.
  • CpuFreq1 calculates the CPU target frequency to be adjusted according to the CPU occupancy rate of CpuGover1.1 and CpuGover1.2 according to the policy.
  • the policy may be configured to initialize the configuration to the configuration information, and the corresponding policy may be: screening the CPU occupancy rate and obtaining the nominal CPU frequency corresponding to the CPU occupancy rate.
  • Step 24 Suspending a timer in a domain to which the thread that triggers the frequency modulation belongs.
  • CpuFreq1 first notifies the CPUFreq of other domains to suspend the timer.
  • CpuFreq1 suspends the timer of this domain again, so as to maximize the The timing of all timers is consistent, and the reliability of adjusting the CPU frequency is also improved.
  • Step 25 Calculate a timer parameter according to the CPU target frequency and set a CPU frequency value of the thread that triggers the frequency modulation.
  • the timer is adjusted to the key parameters of the timer (for example, for the tick value, if the timer is set to trigger a timer check every 100tick before adjustment, the adjustment may be set to 200tick to trigger a timer check) Therefore, before the CPU frequency adjustment, the corresponding timer parameter can be selected as the updated timer parameter according to the correspondence between the CPU frequency and the timer parameter in the configuration table of the OS instance.
  • CpuFreq1 sends the CPU target frequency to the CPUFreq of other domains, and each CpuFreq calculates its own timer parameters according to the CPU target frequency. After calculating the timer parameters, the CPU frequency is adjusted by calling the driver of the CPU, and dynamic loading is also supported in the multi-core system of the AMP and SMP hybrid deployment modes.
  • step 26 the timer is restarted.
  • the timer In order to ensure the reliability of the multi-core system in the AMP and SMP hybrid deployment mode, the timer must be restarted after each setting of the CPU frequency value, so that when the frequency adjustment of the CPU fails, the operation can be abandoned and the next timing is to be performed.
  • the processor times out to re-adjust the CPU frequency.
  • step 25 for the case shown in FIG. 1, there are threads in the same domain in the same OS instance to adjust the CPU frequency, threads in different domains in the same OS instance to adjust the CPU frequency, and thread adjustments in different domains in different OS instances.
  • the CPU frequency and so on, so these conditions will be described in detail below.
  • CpuFreq1 calls the CPU driver to set the CPU frequency and sends the CPU frequency to CpuFreq2.
  • CpuFreq1 calculates and sets the local timer parameters according to the new CPU frequency, and CpuFreq2 also sets the timer parameters of CpuGover2.1 according to its own rules (CpuGover2.1 is the thread of OS1 in domain 2, so set the CPU frequency in OS1. It also needs to be synchronized with it. The synchronous operation is done by the main hard thread CpuFreq2 in domain 2.)
  • both CpuFreq1 and CpuFreq2 re-trigger the timer to complete the triggering process.
  • CpuGover 1.2 when CpuGover 1.2 triggers the FM process, it will report the main hard thread CpuFreq1 of the OS instance.
  • CpuFreq1 sends the CPU frequency parameter to the main hard thread CpuFreq2 of domain 2.
  • CpuFreq2 calculates the CPU to be adjusted.
  • a suspend operation notification is sent to the main hard thread CpuFreq2 of the domain 2 and from the hard thread CpuFreq3 (since the domain 2 in which the thread triggering the frequency modulation is included includes three instances of OS1, OS2, and OS3, the mains of OS1 and OS2 are required. Hard threads and OS3's CPU frequency adjustment from hard threads).
  • CpuFreq2 calls the CPU driver to set the CPU frequency and sends the CPU frequency to CpuFreq1 and CpuFreq3.
  • CpuFreq2 sets the local timer parameters according to its own rules.
  • CpuFreq1 sets the timer parameters of CpuGover1.2 according to its own rules
  • CpuFreq3 adjusts its own timer parameters according to the new CPU frequency. After the timer parameters are set, CpuFreq1, CpuFreq2, and CpuFreq3 re-trigger the timer to complete the triggering of the FM process.
  • CpuGover2.1 when CpuGover2.1 triggers the FM process, it will report the main hard thread CpuFreq2 of the OS instance.
  • CpuFreq2 sends the CPU frequency parameter to the main hard thread CpuFreq1 of domain 1.
  • CpuFreq1 calculates the CPU to be adjusted. After the target frequency, a suspend operation notification is sent to the main hard thread CpuFreq2 of domain 2.
  • CpuFreq1 calls the CPU driver to set the CPU frequency and sends the CPU frequency to CpuFreq2.
  • CpuFreq1 sets the local timer parameters according to its own rules
  • CpuFreq2 calculates and sets the timer parameters of CpuGover2.1 according to the new CPU frequency. After the timer parameters are set, both CpuFreq1 and CpuFreq2 re-trigger the timer to complete the triggering process.
  • CpuGover2.2 when CpuGover2.2 triggers the FM process, it will report to the main hard thread CpuFreq2 of the OS instance. After CpuFreq2 calculates the CPU target frequency to be adjusted, it will send the main hard thread CpuFreq2 and Domain 2 to Domain 1.
  • the suspend operation notification is sent from the hard thread CpuFreq3.
  • CpuFreq1 calls the CPU driver to set the CPU frequency and sends the CPU frequency to CpuFreq2 and CpuFreq3.
  • CpuFreq1 sets the local timer parameters according to its own rules.
  • CpuFreq2 calculates and sets the timer parameters of CpuGover2.2 according to the new CPU frequency
  • CpuFreq3 calculates and sets its own timer parameters according to the new CPU frequency. After the timer parameters are set, CpuFreq1, CpuFreq2, and CpuFreq3 re-trigger the timer to complete the triggering of the FM process.
  • CpuGover3 when CpuGover3 triggers the FM process, it will report to the hard disk CpuFreq3 of the OS instance (because OS3 does not have a main hard thread in domain 2, so it can only report to the hard thread first), CpuFreq3 will The CPU frequency parameter is sent to the main hard thread CpuFreq2 in the domain. After calculating the CPU target frequency to be adjusted, CpuFreq2 sends a suspend operation notification to CpuFreq2 and CpuFreq3. When CpuFreq1, CpuFreq2, and CpuFreq3 both suspend the currently triggered timer, CpuFreq2 calls the CPU driver to set the CPU frequency and sends the CPU frequency to CpuFreq1 and CpuFreq3.
  • CpuFreq1 and CpuFreq2 set local timer parameters according to their own rules, and CpuFreq3 also calculates and sets the timer parameters of CpuGover3 according to the new CPU frequency. After the timer parameters are set, CpuFreq1, CpuFreq2, and CpuFreq3 re-trigger the timer to complete the triggering of the FM process.
  • the embodiment provided by the present invention synchronizes the CPU frequency value of each thread in each domain according to the CPU occupancy rate of each thread that triggers the frequency modulation, realizes the multi-core system in the AMP deployment mode, and adopts the AMP and SMP hybrid deployment mode.
  • the CPU frequency is synchronized under the multi-core system, thereby realizing the energy saving of the CPU.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only storage memory (Read-Only) Memory, ROM) or Random Access Memory (RAM).
  • the embodiment of the present invention further provides an apparatus for implementing energy saving of the CPU.
  • the method may further include a domain obtaining unit 101, a frequency calculating unit 102, and a frequency adjusting unit 103.
  • the domain obtaining unit 101 is configured to acquire each domain.
  • the frequency calculation unit 102 is configured to use the CPU occupancy rate of the thread that triggers the frequency adjustment obtained by the domain acquisition unit 101 in the domain to which the thread that triggers the frequency modulation belongs.
  • the CPU target frequency to be adjusted is calculated;
  • the frequency adjustment unit 103 is configured to calculate a timer parameter according to the CPU target frequency obtained by the frequency calculation unit 102 and set a CPU frequency value of the thread that triggers the frequency modulation.
  • the domain obtaining unit may include a monitoring sending subunit for monitoring the CPU occupancy rate of all the slave threads in each domain, if the CPU occupancy rate of one or more slave threads is greater than the threshold value Transmitting the CPU occupancy rate;
  • the frequency calculation unit includes a frequency acquisition subunit, and is configured to select a maximum value of the CPU occupation rate among the CPU occupation ratios of all the threads that trigger the frequency adjustment in each domain, and according to Corresponding relationship between the CPU occupancy rate and the CPU frequency in the configuration table of the OS instance, the corresponding CPU frequency value is selected as the CPU target frequency;
  • the frequency adjustment unit includes a timer suspending subunit for the thread that triggers the frequency modulation. The timer is suspended in the domain to which it belongs.
  • the frequency adjustment unit 103 may include the following cases:
  • the frequency adjustment unit 103 includes a first timer suspension subunit, a first frequency setting transmission subunit, and a first timer parameter setting.
  • the unit and the first timer triggering subunit, the first timer suspending subunit is configured to suspend the currently triggered timer and the OS instance when the thread that triggers the frequency modulation is in the same domain as the main hard thread of the OS instance.
  • the timer of the domain in which the other thread is located; the first frequency setting sending subunit is configured to call the CPU driver to set the CPU frequency in the main hard thread of the same domain as the thread that triggers the frequency modulation, and send the CPU frequency to the location
  • the other thread of the OS instance is located;
  • the first timer parameter setting subunit is configured to calculate and set a local timer parameter in the main hard thread of a domain together with the thread that triggers the frequency modulation, and other threads of the OS instance
  • the main hard thread of the domain sets the timer parameters of other threads of the OS instance according to its own rules; the first timer triggering subunit is used to trigger the frequency of the thread. Timer domain where the other threads of the OS instance to re-triggered.
  • the frequency adjustment unit 103 includes the second CPU frequency parameter transmission subunit, the second timer suspension subunit, and the second frequency setting transmitter. a unit, a second timer parameter setting subunit, and a second timer triggering subunit, wherein the second CPU frequency parameter sending subunit is configured to trigger when the thread that triggers the frequency modulation is not in the same domain as the main hard thread of the OS instance
  • the main hard thread of the OS instance to which the frequency-modulated thread belongs sends the CPU frequency parameter of the thread that triggers the frequency modulation to the main hard thread of the domain to which the thread that triggers the frequency modulation belongs; the second timer suspends the sub-unit to suspend the current trigger at the same time.
  • a timer a timer of a domain in which the other thread of the OS instance is located; a second frequency setting transmitting subunit configured to call the CPU driver to set a CPU frequency in a main hard thread of the same domain as the thread that triggers the frequency modulation, and Sending the CPU frequency to the domain of the thread that triggers the frequency modulation;
  • the second timer parameter setting subunit is used to be in the same state as the thread that triggers the frequency modulation
  • the main hard thread calculates and sets a local timer parameter according to its own rules, and the main hard thread of the OS instance to which the thread that triggers the frequency modulation calculates and sets the timer parameter of the trigger frequency modulation;
  • the second timer trigger subunit is used for The timer of the domain of the thread that triggers the frequency modulation is re-triggered with the timer of the domain of the other thread of the OS instance.
  • the frequency adjustment unit 103 includes a third CPU frequency parameter transmission subunit, a third timer suspension subunit, and a third frequency setting transmitter.
  • the unit, the third timer parameter setting subunit and the third timer triggering subunit, the third CPU frequency parameter sending subunit is configured to send the CPU frequency parameter when the thread triggering the frequency modulation does not occupy the main hard thread in the domain
  • the main hard thread of the OS instance to which the thread that triggers the trigger is assigned; the third timer suspends the sub-unit for simultaneously suspending the currently triggered timer and the timer of the thread of another OS instance in the domain to which the frequency-triggered thread belongs;
  • the three frequency setting transmitting subunit is configured to call the CPU driver to set the CPU frequency in the main hard thread of the same domain as the thread that triggers the frequency modulation, and send the CPU frequency to the other OS in the domain of the thread that triggers the frequency modulation.
  • the hard thread of the instance; the third timer parameter setting subunit is used to calculate and set the main hard thread in the same domain as the thread that triggers the frequency modulation according to the new CPU frequency
  • the local timer parameter, the hard thread of the other OS instance in the domain of the thread that triggers the frequency modulation sets the local timer parameter according to its own rule; the third timer triggers the subunit, which is used to set the domain of the thread that triggers the frequency modulation.
  • the timer of the hard thread of other OS instances in the domain of the thread that triggers the frequency modulation is re-triggered.
  • the embodiment provided by the present invention synchronizes the CPU frequency value of each thread in each domain according to the CPU occupancy rate of each thread that triggers the frequency modulation, realizes the multi-core system in the AMP deployment mode, and adopts the AMP and SMP hybrid deployment mode.
  • the CPU frequency is synchronized under the multi-core system, thereby realizing the energy saving of the CPU.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Power Sources (AREA)

Abstract

一种实现CPU节能的方法及装置,相应的方法包括获取每个域中所有触发调频的线程的CPU占有率及所属的域;在所述触发调频的线程所属的域中,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率;根据所述CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。本发明根据每个触发调频的线程的CPU占有率对对每个域中的线程的CPU频率值进行同步,进而在多核系统下同步CPU频率值,实现了CPU的节能。

Description

一种实现CPU节能的方法及装置
本申请要求了2010年11月29日提交的、申请号为201010571667.9、发明名称为“一种实现CPU节能的方法及装置”的中国申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及一种实现CPU节能的方法及装置,尤其涉及一种在多核系统模式下实现CPU节能的方法及装置。
发明背景
节能减排已经成为国际政治与经济中的一大热点问题,由于广泛应用而引起的通信设备的节能问题则是热点问题中的热点。典型的电信环境是在一组机框中设有一组单板,每个单板上有多个运行实体,这些实体可以是CPU、核、VCPU或者超线程(逻辑核)。一个CPU可以有多个核,一个核可能会有一个或者多个硬线程。一个OS(Operation System,操作系统)实例会部署到一个或者多个运行实体。其中的CPU节能可以通过逐级调节频率达到低频以降低功耗来实现。
已有的OS实例主要包括SMP(Symmetric multiprocessing,对称多处理器)和AMP(Asymmetric multiprocessing,非对称多处理器)。对于SMP,由于只有一个OS实例,该OS实例可以同时管理所有的CPU内核,能够定时监控CPU占有率,当发现过高或者过低时就可以调整CPU频率以达到节能的目的。对于AMP部署模式的多核系统以及采用AMP和SMP混合部署模式的多核系统,其主要特征是:在一个域内运行有多个操作系统实例,每个OS实例都可以独立控制自己的CPU主频,其中一个域中的所有硬线程共用同一个CPU频率。若在一个域内运行多个OS实例,当每个OS实例分别去控制CPU频率时就会发生冲突。
在实现本发明过程中,发明人发现现有技术中至少存在如下问题:
现有的CPU节能技术中,对于多核系统,无法通过调整CPU的频率以实现节能。
发明内容
本发明的实施例提供了一种实现CPU节能的方法及装置,能够在多核系统下同步CPU频率值,以实现CPU的节能。
一种实现CPU节能的方法,包括:
获取每个域中所有触发调频的线程的CPU占有率及所属的域;
在所述触发调频的线程所属的域中,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率;
根据所述CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
一种实现CPU节能的装置,包括:
域获取单元,用于获取每个域中所有触发调频的线程的CPU占有率及所属的域;
频率计算单元,用于在所述触发调频的线程所属的域中,根据所述域获取单元获取的触发调频的线程的CPU占有率计算需要调整的CPU目标频率;
频率调整单元,用于根据所述频率计算单元获得的CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
由上述本发明的实施例提供的技术方案可以看出,根据每个触发调频的线程的CPU占有率对每个域中的线程的CPU频率值进行同步,进而在多核系统下同步CPU频率值,从而实现了CPU的节能。
附图简要说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明的实施例提供的AMP和SMP混合部署模式的结构示意图;
图2为本发明的实施例提供的在多核系统模式下实现CPU节能的方法流程示意图;
图3为本发明的实施例提供的初始化配置CpuFreq1线程的时序图;
图4为本发明的实施例提供的CpuFreq1线程计算CPU目标频率的时序图;
图5为本发明的实施例提供的CpuGover1.1触发调频流程的调整CPU频率的时序图;
图6为本发明的实施例提供的CpuGover1.2触发调频流程的调整CPU频率的时序图;
图7为本发明的实施例提供的CpuGover2.1触发调频流程的调整CPU频率的时序图;
图8为本发明的实施例提供的CpuGover2.2触发调频流程的调整CPU频率的时序图;
图9为本发明的实施例提供的CpuGover3触发调频流程的调整CPU频率的时序图;
图10为本发明的实施例提供的实现CPU节能的装置的结构示意图。
实施本发明的方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的实施例提出的是一种实现CPU节能的方法,包括获取每个域中所有触发调频的线程的CPU占有率及所属的域;在所述触发调频的线程所属的域中,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率;根据所述CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。图1所示的是一种AMP和SMP混合部署模式的多核系统,深色的圆和浅色的圆分别表示物理属性一致的核,该核被作为一个天然域(深色为域1、浅色为域2),因为域内所有的硬线程共用同一CPU主频。在每个域内都有一个深色外环的硬线程(图1中的pthread1和pthread 5),该硬线程表示域内的主硬线程,其它硬线程为从硬线程。具体地,依据图1的部署模式,每个OS实例都有硬线程CpuFreq,CpuFreq依据跨域个数创建cpuGover线程,于是有如下的关系:
OS1包含CpuFreq1,CpuFreq1包括CpuGover1.1(包括pthread1、3和4,属于域1)和CpuGover1.2(包括pthread6和7,属于域2);
OS2包含CpuFreq2,CpuFreq2包括CpuGover2.1(包括pthread2,属于域1)和CpuGover2.2(包括pthread5,属于域2);
OS3包含CpuFreq3,CpuFreq3包括CpuGover3(包括pthread8,属于域2)。
CpuGover线程主要负责CPU占有率的监控及获取,然后上报给自己的管理者CpuFreq,CpuGover不存在分布式概念,在一个OS实例下只能看到自己,看不到OS实例内部的其它Gover,也看不到其它OS实例的Gover。
CpuFreq负责收集CPU占有率,然后对CPU占有率就行分析处理;并处理结果同步给主CpuFreq,各个CpuFreq自己进行定时器参数的调整,最后由主CpuFreq进行频率设置。
由于CpuFreq是分布式存在,因此相互之间需要同步信息。其中对于CPU占有率的处理是在多个CPU占有率数值中依据配置的策略选择合适的CPU占有率,然后硬件支持特征设置频率更新定时器参数,以保证时间与频率的一致。
下面按各个线程对CPU的频率进行调整的顺序对实现CPU节能的方法作具体说明,如图2所示,该方法具体可以包括:
步骤21,初始化配置硬线程CpuFreq。
CpuFreq的身份确定和部署是通过配置完成的,配置信息包括公共信息和私有信息,公共信息为单板上所有域的ID及每个域的CpuFreq的位置信息,私有信息为所在OS下的域特征。配置好的CpuFreq可以创建CpuGover实例,因为支持动态创建,所以CpuFreq需要清除原有的CpuGover后注册新的CpuGover,并启动对线程的监控。
具体的,以CpuFreq1为例,在图3中,CpuFreq1首先注销原有的cpu governor并停止原有的cpu gover线程,然后注册新的cpu gover并在域中创建cpu gover实例及创建cpu gover线程,创建的线程包括CpuGover1.1和CpuGover1.2,线程创建完成后启动对每个线程的监控。
步骤22,获取每个域中所有触发调频的线程的CPU占有率及所属的域。
按层次可以将CpuGover划分为底层,将CpuFreq划分为上层,在一个OS实例内底层可能有多个实例,上层将多个实例进行汇聚整合为一个硬线程。同时还为每个线程设置一个定时器,定时器的步长可以CPU的占有率更新频率为基准。
具体的,以CpuFreq1为例,如图4所示,如果定时器超时,则CpuGover 1.1和CpuGover1.2会获取自身的CPU占有率并向CpuFreq1上报,CpuFreq1记录各线程的CPU占有率及根据各线程的配置信息获取相应的线程所属的域。
对于CpuGover何时上报CPU占有率可以设置一个门限值,当CPU占有率的变化值大于门限值时,则CpuGover向CpuFreq上报CPU占有率,当CPU占有率的变化值小于门限值时,则不上报CPU占有率,以减少不必要的消息流量。
步骤23,在所述触发调频的线程所属的域中,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率。
在计算CPU目标频率的过程中,首先选择最高CPU占有率的线程进行处理,计算出所在OS实例的定时器参数。如果在CpuFreq无法获取域的主CpuFreq的信息时将按照最高频率进行处理。
具体的,以CpuFreq1为例,如图4所示,CpuFreq1依据策略,根据CpuGover1.1和CpuGover1.2的CPU占有率计算需要调整的CPU目标频率。所述的策略可以在初始化配置到配置信息中,相应的策略可以为:筛选CPU占有率并获取CPU占有率对应的标称CPU频率。
步骤24,在所述触发调频的线程所属的域中挂起定时器。
具体地,CpuFreq1首先通知其它域的CpuFreq挂起定时器,当其它域的CpuFreq挂起定时器并向CpuFreq1返回挂起响应后,CpuFreq1再挂起本域的定时器,这样是为了最大限度的使所有定时器的时间保持一致,同时也能提高调整CPU频率的可靠性。
步骤25,根据所述CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
由于调整定时器的时候会调整到定时器的关键参数(例如对于tick值,若调整之前定时器设定为每100tick触发一个定时器检查,调整之后可能会设定为200tick触发一个定时器检查),因此在CPU频率调整之前,可以根据OS实例的配置表中的CPU频率和定时器参数的对应关系,选择对应的定时器参数作为更新的定时器参数。
具体的,CpuFreq1发送CPU目标频率给其它域的CpuFreq,每个CpuFreq都会根据CPU目标频率计算自己何时的定时器参数。计算出定时器参数后,通过调用CPU的驱动程序调整CPU的频率值,在AMP和SMP混合部署模式的多核系统中还支持动态加载。
步骤26,重新启动定时器。
为了保证AMP和SMP混合部署模式的多核系统的可靠性,在每次设置完CPU频率值之后,还要重启定时器,这样当CPU的频率调整失败时,可以放弃本次操作,待下次定时器超时则重新调整CPU的频率。
进一步地,在步骤25中,对于图1所示的情况,存在相同OS实例中相同域的线程调整CPU频率、相同OS实例中不同域的线程调整CPU频率、不同OS实例中不同域的线程调整CPU频率等情况,因此下面对这些情况进行详细说明。
CPU调频实施例一
如图5所示,当CpuGover1.1触发调频流程时,会先上报到所属OS实例的主硬线程CpuFreq1(相当于图1中的pthread1),CpuFreq1计算出需要调整的CPU目标频率后,向域2的主硬线程CpuFreq2(相当于图1中的pthread5)发送挂起操作通知(由于触发调频的线程所在的域1仅包括OS1和OS2两个实例,因此仅由OS1和OS2的主硬线程进行CPU频率调整)。当CpuFreq1和CpuFreq2都挂起当前触发的定时器后,CpuFreq1调用CPU驱动程序设置CPU频率并将该CPU频率发送给CpuFreq2。CpuFreq1根据新的CPU频率计算并设置本地的定时器参数,同时CpuFreq2也根据自身的规则设置CpuGover2.1的定时器参数(CpuGover2.1是OS1的处于域2中的线程,因此在OS1设置CPU频率时也需要与之同步,同步的操作由域2中的主硬线程CpuFreq2完成)。设置完定时器参数后,CpuFreq1和CpuFreq2都重新触发定时器,完成本次触发调频流程。
CPU调频实施例二
如图6所示,当CpuGover1.2触发调频流程时,会先上报到所属OS实例的主硬线程CpuFreq1,CpuFreq1将CPU频率参数发送给域2的主硬线程CpuFreq2,CpuFreq2计算出需要调整的CPU目标频率后,向域2的主硬线程CpuFreq2和从硬线程CpuFreq3发送挂起操作通知(由于触发调频的线程所在的域2包括OS1、OS2和OS3共三个实例,因此需要OS1和OS2的主硬线程以及OS3的从硬线程进行CPU频率调整)。当CpuFreq1、CpuFreq2和CpuFreq3都挂起当前触发的定时器后,CpuFreq2调用CPU驱动程序设置CPU频率并将该CPU频率发送给CpuFreq1和CpuFreq3。CpuFreq2根据自身规则设置本地的定时器参数,同时CpuFreq1根据自身的规则设置CpuGover1.2的定时器参数,以及CpuFreq3根据新的CPU频率调整自己的定时器参数。设置完定时器参数后,CpuFreq1、CpuFreq2和CpuFreq3都重新触发定时器,完成本次触发调频流程。
CPU调频实施例三
如图7所示,当CpuGover2.1触发调频流程时,会先上报到所属OS实例的主硬线程CpuFreq2,CpuFreq2将CPU频率参数发送给域1的主硬线程CpuFreq1,CpuFreq1计算出需要调整的CPU目标频率后,向域2的主硬线程CpuFreq2发送挂起操作通知,当CpuFreq1和CpuFreq2都挂起当前触发的定时器后,CpuFreq1调用CPU驱动程序设置CPU频率并将该CPU频率发送给CpuFreq2。CpuFreq1根据自身规则设置本地的定时器参数,同时CpuFreq2根据新CPU频率计算并设置CpuGover2.1的定时器参数。设置完定时器参数后,CpuFreq1和CpuFreq2都重新触发定时器,完成本次触发调频流程。
CPU调频实施例四
如图8所示,当CpuGover2.2触发调频流程时,会先上报到所属OS实例的主硬线程CpuFreq2,CpuFreq2计算出需要调整的CPU目标频率后,向域1的主硬线程CpuFreq2及域2的从硬线程CpuFreq3发送挂起操作通知。当CpuFreq1、CpuFreq2和CpuFreq3都挂起当前触发的定时器后,CpuFreq2调用CPU驱动程序设置CPU频率并将该CPU频率发送给CpuFreq2和CpuFreq3。CpuFreq1根据自身规则设置本地的定时器参数,同时CpuFreq2也根据新的CPU频率计算并设置CpuGover2.2的定时器参数,以及CpuFreq3根据新的CPU频率计算并设置自身的定时器参数。设置完定时器参数后,CpuFreq1、CpuFreq2和CpuFreq3都重新触发定时器,完成本次触发调频流程。
CPU调频实施例五
如图9所示,当CpuGover3触发调频流程时,会先上报到所属OS实例的从硬线程CpuFreq3(由于OS3在域2内没有主硬线程,因此只能先上报到从硬线程),CpuFreq3将CPU频率参数发送给所述域中的主硬线程CpuFreq2,CpuFreq2计算出需要调整的CPU目标频率后,向CpuFreq2及CpuFreq3发送挂起操作通知。当CpuFreq1、CpuFreq2和CpuFreq3都挂起当前触发的定时器后,CpuFreq2调用CPU驱动程序设置CPU频率并将该CPU频率发送给CpuFreq1和CpuFreq3。CpuFreq1和CpuFreq2根据自身规则设置本地的定时器参数,同时CpuFreq3也根据新的CPU频率计算并设置CpuGover3的定时器参数。设置完定时器参数后,CpuFreq1、CpuFreq2和CpuFreq3都重新触发定时器,完成本次触发调频流程。
本发明提供的实施例根据每个触发调频的线程的CPU占有率对对每个域中的线程的CPU频率值进行同步,实现了在AMP部署模式的多核系统以及采用AMP和SMP混合部署模式的多核系统下同步CPU频率值,从而实现了CPU的节能。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
本发明的实施例还提供了一种实现CPU节能的装置,如图10所示,具体可以包括域获取单元101、频率计算单元102和频率调整单元103,域获取单元101用于获取每个域中所有触发调频的线程的CPU占有率及所属的域;频率计算单元102用于在所述触发调频的线程所属的域中,根据所述域获取单元101获取的触发调频的线程的CPU占有率计算需要调整的CPU目标频率;频率调整单元103用于根据所述频率计算单元102获得的CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
进一步地,在所述域获取单元中可以包括监测发送子单元,用于监测每个域中所有从线程的CPU占有率,若其中一个或多个从线程的CPU占有率的变化大于门限值,则发送所述CPU占有率;在所述频率计算单元中包括频率获取子单元,用于在每个域中所有触发调频的线程的CPU占有率中选出CPU占有率的最大值,并根据OS实例的配置表中的CPU占有率和CPU频率的对应关系选择相应的CPU频率值作为CPU目标频率;在所述频率调整单元中包括定时器挂起子单元,用于在所述触发调频的线程所属的域中挂起定时器。
以及,当不同域中不同的线程触发调频时,在频率调整单元103可以包括以下的情况:
①、当触发调频的线程与所属OS实例的主硬线程在同一域中时,在频率调整单元103包括第一定时器挂起子单元、第一频率设置发送子单元、第一定时器参数设置子单元和第一定时器触发子单元,第一定时器挂起子单元用于当触发调频的线程与OS实例的主硬线程同在一个域时,同时挂起当前触发的定时器与所述OS实例的其它线程所在域的定时器;第一频率设置发送子单元用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述OS实例的其它线程所在域;第一定时器参数设置子单元用于与所述触发调频的线程同在一个域的主硬线程计算并设置本地的定时器参数,所述OS实例的其它线程所在域的主硬线程根据自身规则设置所述OS实例的其它线程的定时器参数;第一定时器触发子单元用于将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
②、当触发调频的线程与所属OS实例的主硬线程不在同一域中时,在频率调整单元103包括第二CPU频率参数发送子单元、第二定时器挂起子单元、第二频率设置发送子单元、第二定时器参数设置子单元和第二定时器触发子单元,第二CPU频率参数发送子单元用于当触发调频的线程与OS实例的主硬线程不在同一个域时,所述触发调频的线程所属OS实例的主硬线程将所述触发调频的线程的CPU频率参数发送给所述触发调频的线程所属域的主硬线程;第二定时器挂起子单元用于同时挂起当前触发的定时器、所述OS实例的其它线程所在域的定时器;第二频率设置发送子单元用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域;第二定时器参数设置子单元用于与所述触发调频的线程同在一个域的主硬线程根据自身规则计算并设置本地的定时器参数,所述触发调频的线程所属OS实例的主硬线程计算并设置所述触发调频的定时器参数;第二定时器触发子单元用于将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
③、当触发调频的线程所述的域中没有OS实例的主硬线程时,在频率调整单元103包括第三CPU频率参数发送子单元、第三定时器挂起子单元、第三频率设置发送子单元、第三定时器参数设置子单元和第三定时器触发子单元,第三CPU频率参数发送子单元用于当触发调频的线程在所属域中不占有主硬线程时,将CPU频率参数发送给所述触发调频的线程所属OS实例的主硬线程;第三定时器挂起子单元用于同时挂起当前触发的定时器、触发调频的线程所属域中其它OS实例的线程的定时器;第三频率设置发送子单元用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域中其它OS实例的硬线程;第三定时器参数设置子单元用于与所述触发调频的线程同在一个域的主硬线程根据新CPU频率计算并设置本地的定时器参数,所述触发调频的线程所在域中其它OS实例的硬线程根据自身规则设置本地的定时器参数;第三定时器触发子单元,用于将触发调频的线程所在域与所述触发调频的线程所在域中其它OS实例的硬线程的定时器重新触发。
上述装置中包含的各单元及子单元的功能已在之前的方法实施例中详细叙述,在本实施例中就不再敷述。
本发明提供的实施例根据每个触发调频的线程的CPU占有率对对每个域中的线程的CPU频率值进行同步,实现了在AMP部署模式的多核系统以及采用AMP和SMP混合部署模式的多核系统下同步CPU频率值,从而实现了CPU的节能。
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。

Claims (14)

  1. 一种实现CPU节能的方法,其特征在于,包括:
    获取每个域中所有触发调频的线程的CPU占有率及所属的域;
    在所述触发调频的线程所属的域中,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率;
    根据所述CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
  2. 根据权利要求1所述的方法,其特征在于,所述触发调频包括:
    监测每个域中所有从线程的CPU占有率,若其中一个或多个从线程的CPU占有率的变化大于门限值,则发送所述CPU占有率。
  3. 根据权利要求1所述的方法,其特征在于,根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率包括:
    在每个域中所有触发调频的线程的CPU占有率中选出CPU占有率的最大值,并根据操作系统OS实例的配置表中的CPU占有率和CPU频率的对应关系选择相应的CPU频率值作为CPU目标频率。
  4. 根据权利要求1所述的方法,其特征在于,在根据所述触发调频的线程的CPU占有率计算需要调整的CPU目标频率之后还包括:
    在所述触发调频的线程所属的域中挂起定时器。
  5. 根据权利要求1至4任意一项所述的方法,其特征在于,设置所述触发调频的线程的CPU频率值包括:
    当触发调频的线程与OS实例的主硬线程同在一个域时,同时挂起当前触发的定时器与所述OS实例的其它线程所在域的定时器;
    与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述OS实例的其它线程所在域;
    与所述触发调频的线程同在一个域的主硬线程计算并设置本地的定时器参数,所述OS实例的其它线程所在域的主硬线程根据自身规则设置所述OS实例的其它线程的定时器参数;
    将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
  6. 根据权利要求1至4任意一项所述的方法,其特征在于,设置所述触发调频的线程的CPU频率值包括:
    当触发调频的线程与OS实例的主硬线程不在同一个域时,所述触发调频的线程所属OS实例的主硬线程将所述触发调频的线程的CPU频率参数发送给所述触发调频的线程所属域的主硬线程;
    同时挂起当前触发的定时器、所述OS实例的其它线程所在域的定时器;
    与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域;
    与所述触发调频的线程同在一个域的主硬线程根据自身规则计算并设置本地的定时器参数,所述触发调频的线程所属OS实例的主硬线程计算并设置所述触发调频的定时器参数;
    将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
  7. 根据权利要求1至4任意一项所述的方法,其特征在于,设置所述触发调频的线程的CPU频率值包括:
    当触发调频的线程在所属域中不占有主硬线程时,将CPU频率参数发送给所述触发调频的线程所属OS实例的主硬线程;
    同时挂起当前触发的定时器、触发调频的线程所属域中其它OS实例的线程的定时器;
    与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域中其它OS实例的硬线程;
    与所述触发调频的线程同在一个域的主硬线程根据新CPU频率计算并设置本地的定时器参数,所述触发调频的线程所在域中其它OS实例的硬线程根据自身规则设置本地的定时器参数;
    将触发调频的线程所在域与所述触发调频的线程所在域中其它OS实例的硬线程的定时器重新触发。
  8. 一种实现CPU节能的装置,其特征在于,包括:
    域获取单元,用于获取每个域中所有触发调频的线程的CPU占有率及所属的域;
    频率计算单元,用于在所述触发调频的线程所属的域中,根据所述域获取单元获取的触发调频的线程的CPU占有率计算需要调整的CPU目标频率;
    频率调整单元,用于根据所述频率计算单元获得的CPU目标频率计算定时器参数并设置所述触发调频的线程的CPU频率值。
  9. 根据权利要求8所述的装置,其特征在于,在所述域获取单元中包括:
    监测发送子单元,用于监测每个域中所有从线程的CPU占有率,若其中一个或多个从线程的CPU占有率的变化大于门限值,则发送所述CPU占有率。
  10. 根据权利要求8所述的装置,其特征在于,在所述频率计算单元中包括:
    频率获取子单元,用于在每个域中所有触发调频的线程的CPU占有率中选出CPU占有率的最大值,并根据操作系统OS实例的配置表中的CPU占有率和CPU频率的对应关系选择相应的CPU频率值作为CPU目标频率。
  11. 根据权利要求8所述的装置,其特征在于,在所述频率调整单元中包括:
    定时器挂起子单元,用于在所述触发调频的线程所属的域中挂起定时器。
  12. 根据权利要求8至11任意一项所述的装置,其特征在于,在所述频率调整单元中包括:
    第一定时器挂起子单元,用于当触发调频的线程与OS实例的主硬线程同在一个域时,同时挂起当前触发的定时器与所述OS实例的其它线程所在域的定时器;
    第一频率设置发送子单元,用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述OS实例的其它线程所在域;
    第一定时器参数设置子单元,用于与所述触发调频的线程同在一个域的主硬线程计算并设置本地的定时器参数,所述OS实例的其它线程所在域的主硬线程根据自身规则设置所述OS实例的其它线程的定时器参数;
    第一定时器触发子单元,用于将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
  13. 根据权利要求8至11任意一项所述的装置,其特征在于,在所述频率调整单元中还包括:
    第二CPU频率参数发送子单元,用于当触发调频的线程与OS实例的主硬线程不在同一个域时,所述触发调频的线程所属OS实例的主硬线程将所述触发调频的线程的CPU频率参数发送给所述触发调频的线程所属域的主硬线程;
    第二定时器挂起子单元,用于同时挂起当前触发的定时器、所述OS实例的其它线程所在域的定时器;
    第二频率设置发送子单元,用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域;
    第二定时器参数设置子单元,用于与所述触发调频的线程同在一个域的主硬线程根据自身规则计算并设置本地的定时器参数,所述触发调频的线程所属OS实例的主硬线程计算并设置所述触发调频的定时器参数;
    第二定时器触发子单元,用于将触发调频的线程所在域与所述OS实例的其它线程所在域的定时器重新触发。
  14. 根据权利要求8至11任意一项所述的装置,其特征在于,在所述频率调整单元中还包括:
    第三CPU频率参数发送子单元,用于当触发调频的线程在所属域中不占有主硬线程时,将CPU频率参数发送给所述触发调频的线程所属OS实例的主硬线程;
    第三定时器挂起子单元,用于同时挂起当前触发的定时器、触发调频的线程所属域中其它OS实例的线程的定时器;
    第三频率设置发送子单元,用于与所述触发调频的线程同在一个域的主硬线程调用CPU驱动程序设置CPU频率,并将所述CPU频率发送到所述触发调频的线程所在域中其它OS实例的硬线程;
    第三定时器参数设置子单元,用于与所述触发调频的线程同在一个域的主硬线程根据新CPU频率计算并设置本地的定时器参数,所述触发调频的线程所在域中其它OS实例的硬线程根据自身规则设置本地的定时器参数;
    第三定时器触发子单元,用于将触发调频的线程所在域与所述触发调频的线程所在域中其它OS实例的硬线程的定时器重新触发。
PCT/CN2011/074866 2010-11-29 2011-05-30 一种实现cpu节能的方法及装置 WO2011150792A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/904,461 US9377842B2 (en) 2010-11-29 2013-05-29 Method and apparatus for realizing CPU power conservation

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2010105716679A CN102004543B (zh) 2010-11-29 2010-11-29 一种实现cpu节能的方法及装置
CN201010571667.9 2010-11-29

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/904,461 Continuation US9377842B2 (en) 2010-11-29 2013-05-29 Method and apparatus for realizing CPU power conservation

Publications (1)

Publication Number Publication Date
WO2011150792A1 true WO2011150792A1 (zh) 2011-12-08

Family

ID=43811950

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/074866 WO2011150792A1 (zh) 2010-11-29 2011-05-30 一种实现cpu节能的方法及装置

Country Status (3)

Country Link
US (1) US9377842B2 (zh)
CN (1) CN102004543B (zh)
WO (1) WO2011150792A1 (zh)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102004543B (zh) * 2010-11-29 2013-08-07 华为技术有限公司 一种实现cpu节能的方法及装置
TWI597599B (zh) 2012-06-05 2017-09-01 威盛電子股份有限公司 圖形處理單元與其管理方法
CN103415823B (zh) * 2012-08-30 2016-05-25 华为终端有限公司 一种控制中央处理器的方法和装置
CN102929383A (zh) * 2012-11-06 2013-02-13 山东大学 一种通过cpu动态调频技术降低嵌入式系统功耗的方法
US9292356B2 (en) * 2012-12-03 2016-03-22 Qualcomm Innovation Center, Inc. Thread processing on an asymmetric multi-core processor
JP6142709B2 (ja) * 2013-07-23 2017-06-07 富士通株式会社 計測方法、計測プログラム、携帯情報端末、及びその制御方法
WO2016008066A1 (zh) * 2014-07-14 2016-01-21 华为技术有限公司 一种多核处理器的管理方法及装置
CN105677482B (zh) * 2015-12-31 2020-12-18 联想(北京)有限公司 一种频率调节方法及电子设备
CN105930218A (zh) * 2016-04-18 2016-09-07 深圳市万普拉斯科技有限公司 运算资源频率调整方法及系统
US10503238B2 (en) 2016-11-01 2019-12-10 Microsoft Technology Licensing, Llc Thread importance based processor core parking and frequency selection
US10372494B2 (en) 2016-11-04 2019-08-06 Microsoft Technology Licensing, Llc Thread importance based processor core partitioning
CN109960584A (zh) * 2019-01-30 2019-07-02 努比亚技术有限公司 Cpu调频控制方法、终端及计算机可读存储介质
CN110275510B (zh) * 2019-06-14 2021-12-07 百度在线网络技术(北京)有限公司 车辆控制模型的处理频率调整方法、装置和电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1690955A (zh) * 2004-04-29 2005-11-02 钜格系统科技股份有限公司 手持式信息处理装置的电源管理方法
CN100562854C (zh) * 2008-03-11 2009-11-25 浙江大学 多核处理器操作系统负载均衡的实现方法
CN101067758B (zh) * 2007-06-14 2010-05-19 华南理工大学 一种嵌入式系统的能耗管理方法
CN102004543A (zh) * 2010-11-29 2011-04-06 华为技术有限公司 一种实现cpu节能的方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11184554A (ja) * 1997-12-24 1999-07-09 Mitsubishi Electric Corp クロック制御タイプ情報処理装置
US7770034B2 (en) * 2003-12-16 2010-08-03 Intel Corporation Performance monitoring based dynamic voltage and frequency scaling
CN101201689B (zh) * 2006-12-13 2010-04-14 上海晨兴电子科技有限公司 一种多任务系统中自动管理cpu功耗的方法
US20090271646A1 (en) * 2008-04-24 2009-10-29 Vanish Talwar Power Management Using Clustering In A Multicore System
CN101576768A (zh) * 2009-06-15 2009-11-11 北京中星微电子有限公司 切换设备频率的方法以及设备
US8527796B2 (en) * 2009-08-24 2013-09-03 Intel Corporation Providing adaptive frequency control for a processor using utilization information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1690955A (zh) * 2004-04-29 2005-11-02 钜格系统科技股份有限公司 手持式信息处理装置的电源管理方法
CN101067758B (zh) * 2007-06-14 2010-05-19 华南理工大学 一种嵌入式系统的能耗管理方法
CN100562854C (zh) * 2008-03-11 2009-11-25 浙江大学 多核处理器操作系统负载均衡的实现方法
CN102004543A (zh) * 2010-11-29 2011-04-06 华为技术有限公司 一种实现cpu节能的方法及装置

Also Published As

Publication number Publication date
US20130268787A1 (en) 2013-10-10
CN102004543A (zh) 2011-04-06
CN102004543B (zh) 2013-08-07
US9377842B2 (en) 2016-06-28

Similar Documents

Publication Publication Date Title
WO2011150792A1 (zh) 一种实现cpu节能的方法及装置
WO2018023906A1 (zh) 通信方法及通信装置
CN105471622B (zh) 一种基于Galera的控制节点主备切换的高可用方法及系统
WO2019061720A1 (zh) 一种数据同步的方法和系统
WO2014032477A1 (zh) 一种多核中央处理器的调控方法及系统
WO2018094809A1 (zh) 一种资源共享方法及装置
CN107948136B (zh) 电力调度通信网pcm语音信令和协议通讯转换系统
WO2017139978A1 (zh) 手机app更新方法及系统
TW201445936A (zh) 可動態切換主節點的伺服器系統及動態切換主節點的方法
WO2018018819A1 (zh) 应用程序的管理方法、管理装置及终端
WO2014142610A1 (en) Terminal and method for synchronizing application thereof
WO2017161884A1 (zh) 一种调度信令的配置方法、接收方法和相关设备
CN103210689A (zh) 对pcie设备进行时间同步的方法、装置和系统
WO2013097119A1 (zh) 在文件系统中实现多级存储的方法和装置
WO2019006637A1 (zh) 一种安全云计算系统
CN109120971A (zh) Arm嵌入式播控盒、pis播控网络架构及播控方法
WO2013127195A1 (zh) 链式沟通协作方法、装置及系统
EP2897312B1 (en) Clock synchronization method, system and device
WO2012046929A1 (en) Network attached storage
CN108471452B (zh) 一种单机柜数据中心监控方法、系统及装置
WO2017067261A1 (zh) 一种智能终端的组网方法及装置
WO2018076539A1 (zh) 伪无线接入点识别方法及系统
JP3387464B2 (ja) 通信制御システムとその制御方法
WO2015089839A1 (zh) 一种共享队列中的消息处理方法、装置及接收核
CN104901905B (zh) 一种智能变电站专用网络交换机及其数据交换方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11789171

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11789171

Country of ref document: EP

Kind code of ref document: A1