Processor scheduling method and device, equipment, storage medium and program product

By performing load statistics and bitmap generation on multiple processors, distinguishing active processors from idle processors, centrally processing tasks and adjusting idle processors to energy-saving mode, solving the problem of energy saving in the existing technology that affects performance, and realizing the Efficient energy efficiency balance.

CN118939405APending Publication Date: 2024-11-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310517687.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-09
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

When the prior art saves energy on computer equipment, it usually affects its operating performance, making it difficult to ensure performance and energy saving at the same time.

Method used

By performing load statistics on multiple processors, a processor bitmap is generated, the active processor is distinguished from an idle processor, centrally processing tasks on the active processor and adjusting the idle processor to energy-saving mode.

Benefits of technology

It realizes energy saving while ensuring the operating performance of computer equipment, reduces the trade-off time between performance and power consumption, and improves the energy efficiency of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939405A_ABST
    Figure CN118939405A_ABST
Patent Text Reader

Abstract

The invention provides a processor scheduling method and device, equipment, a storage medium and a program product. The embodiment of the invention can be applied to a processor scheduling scene of computer equipment such as a terminal and a server; the method comprises the following steps: carrying out load statistics on N processors to obtain the total load of the N processors; wherein N is greater than or equal to 2; based on the total load amount of the N processors, corresponding processor bitmaps are generated for the N processors, and the processor bitmaps are used for distinguishing active processors and idle processors in the N processors; and based on the processor bitmap, centralizing the to-be-processed tasks on the active processor for processing, and adjusting the idle processor to the target energy-saving mode. By means of the method and device, the state of the operation performance of the computer equipment can be guaranteed, and energy saving can be conducted on the computer equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer energy-saving technology, and in particular to a processor scheduling method, device, equipment, storage medium and program product. Background Art

[0002] When a computer device is running, it consumes certain resources, such as electrical energy. In order to save energy, some energy-saving technologies can be applied to the CPU so that the CPU runs in energy-saving mode, thereby reducing the energy consumption of the computer device. However, in the related art, there is a problem that when the computer device is saved, the operating performance of the computer device system is affected. Summary of the invention

[0003] The embodiments of the present application provide a processor scheduling method, apparatus, device, computer-readable storage medium, and computer program product, which can both ensure the operating performance of the computer device and save energy for the computer device.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application embodiment provides a processor scheduling method, including:

[0006] Perform load statistics on N processors to obtain the total load of the N processors; wherein N≥2;

[0007] Based on the total load of the N processors, generating corresponding processor bitmaps for the N processors, wherein the processor bitmap is used to distinguish active processors and idle processors among the N processors;

[0008] Based on the processor bitmap, the tasks to be processed are concentrated on the active processors for processing, and the idle processors are adjusted to the target energy-saving mode, thereby completing the scheduling of the N processors.

[0009] The present application embodiment provides a processor scheduling device, including:

[0010] A load statistics module, used to perform load statistics on N processors to obtain the total load of the N processors; wherein N≥2;

[0011] A bitmap generation module, configured to generate a corresponding processor bitmap for the N processors based on the total load of the N processors, wherein the processor bitmap is used to distinguish between active processors and idle processors among the N processors;

[0012] The processor control module is used to process the tasks to be processed on the active processors based on the processor bitmap, and adjust the idle processors to the target energy-saving mode, so as to complete the scheduling of the N processors.

[0013] In some embodiments of the present application, the bitmap generation module is further configured to perform filtering processing on the total load of the N processors to obtain a filtered load; based on the filtered load, determine the target computing power corresponding to the total load; based on the target computing power and the rated computing power of each processor, determine M active processors and N-M idle processors from the N processors; where 1≤M<N; generate an initial bitmap for the N processors, and use a first marker to mark the processor identifiers of the M active processors in the initial bitmap, and use a second marker to mark the processor identifiers of the N-M idle processors in the initial bitmap to obtain the processor bitmap.

[0014] In some embodiments of the present application, the bitmap generation module is further configured to obtain historical load, and perform weighted fusion on the historical load and the total load to complete the filtering processing of the total load to obtain the filtered load; where the weighting weight of the historical load is greater than the weighting weight of the total load.

[0015] In some embodiments of the present application, the bitmap generation module is further configured to determine the corresponding matching computing power and reserved computing power for the filtered load; where the reserved computing power refers to the computing power that the processor needs to have in addition to processing the filtered load; add the matching computing power and the reserved computing power to obtain a superimposed computing power; add a fluctuation computing power corresponding to the load fluctuation to the superimposed computing power, and determine the computing power after adding the fluctuation computing power as the target computing power corresponding to the total load.

[0016] In some embodiments of the present application, the bitmap generation module is further configured to calculate, according to the target computing power and the rated computing power of each processor, the number of the first processors required to reach the target computing power; calculate, according to the number of tasks corresponding to the total load and the task queuing ability of each processor, the number of the second processors required for the number of tasks; determine the largest number of processors among the number of the first processors and the number of the second processors as the number M of the active processors; determine the M processors with the highest load among the N processors as the active processors, and determine the remaining N-M processors as the idle processors.

[0017] In some embodiments of the present application, the bitmap generation module is also used to perform load sampling on each of the processors to obtain load information of each of the processors; accumulate the N load information corresponding to the N processors to complete the load statistics of the N processors, and obtain the total load of the N processors.

[0018] In some embodiments of the present application, the active processor runs in the highest performance mode; the processor frequency of the highest performance mode is the highest frequency, and the sleep depth is the lowest depth; the processor frequency of the target energy saving mode is the lowest frequency, and the sleep depth is the highest depth.

[0019] In some embodiments of the present application, the processor scheduling device also includes: an interrupt migration module, which is used to determine the corresponding mapping processor for the idle processor based on the processor bitmap; through the mapping processor, the interrupt on the idle processor is processed, and the idle processor is adjusted to the target energy saving mode.

[0020] In some embodiments of the present application, the interrupt migration module is also used to eliminate the processor identifier of the idle processor in the processor bitmap to obtain a sparse bitmap; for the processor identifier of the idle processor, the identifier remainder relative to the length of the bitmap array is calculated; the bitmap array is an array obtained by tightly arranging the sparse bitmap; from the bitmap array, a target identifier corresponding to the identifier remainder is screened, and the active processor corresponding to the target identifier is determined as the mapping processor.

[0021] In some embodiments of the present application, the interrupt migration module is also used to process the network card interrupt on the idle processor through the mapping processor to obtain a data packet of the network card interrupt; distribute the data packet on N processors; when the data packet is distributed to the idle processor, migrate the data packet to the mapping processor, and perform soft interrupt processing on the data packet through the mapping processor.

[0022] In some embodiments of the present application, the processor scheduling device further includes: a frequency setting module, configured to set a maximum frequency of the active processor when turbo-clocked, through a maximum frequency parameter.

[0023] An embodiment of the present application provides a computer device, including:

[0024] A memory for storing computer executable instructions;

[0025] The processor is used to implement the processor scheduling method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0026] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute and implement the processor scheduling method provided in the embodiment of the present application.

[0027] An embodiment of the present application provides a computer program product, including a computer program or a computer executable instruction. When the computer program or the computer executable instruction is executed by a processor, the processor scheduling method provided in the embodiment of the present application is implemented.

[0028] The embodiment of the present application has the following beneficial effects: the computer device generates a processor bitmap for distinguishing active processors and idle processors among the N processors through the total load of the N processors, thereby realizing the division of the N processors into active processors and idle processors based on the global load, and by concentrating the tasks to be processed in the active processors for processing, it is possible to quickly respond to the tasks to be processed, thereby ensuring the processing performance of the computer device, and at the same time directly adjusting the idle processors to the target energy-saving mode, so that the idle processors are always in a low-power state, so as to achieve energy saving of the computer device. In this way, it is achieved that the operating performance of the computer device can be guaranteed and the computer device can be saved. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of the energy-saving technology of the CPU;

[0030] Figure 2 It is a schematic diagram of the framework of the CPU energy saving technology when it is implemented;

[0031] Figure 3 It is a schematic diagram of the connection between different energy-saving technologies;

[0032] Figure 4 This is a schematic diagram of the implementation framework of Cstate technology;

[0033] Figure 5 This is a schematic diagram of the implementation framework of the Pstate technology;

[0034] Figure 6 It is a schematic diagram of the framework of Turbo Boost technology;

[0035] Figure 7 is a schematic diagram of the architecture of a processor scheduling system provided in an embodiment of the present application;

[0036] Figure 8 The embodiment of this application provides Figure 1 A schematic diagram of the structure of the server in FIG.

[0037] Fig. 9This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 1 ;

[0038] Fig.10 This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 2 ;

[0039] Fig.11 This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 3 ;

[0040] Fig.12 It is a schematic diagram of a CPU scheduling framework of a server provided in an embodiment of the present application;

[0041] Fig.13A It is a schematic diagram of the calculation process of the active CPU bitmap provided in an embodiment of the present application;

[0042] Fig. 13B This is a schematic diagram of the process of selecting a CPU provided in an embodiment of the present application;

[0043] Fig.14 It is a comparative schematic diagram of task scheduling based on load balancing and task scheduling based on active CPU bitmap provided in an embodiment of the present application;

[0044] Fig.15 This is a comparison diagram of limiting the sleep depth of dormant cores provided in an embodiment of the present application;

[0045] Fig.16 is a schematic diagram of the change of the maximum frequency during turbo frequency provided in an embodiment of the present application;

[0046] Fig.17 It is a comparative schematic diagram of the interruption limitation provided in the embodiment of the present application;

[0047] Fig.18 It is a schematic diagram of the process of interruption migration provided by an embodiment of the present application;

[0048] Fig.19 It is a schematic diagram of the interrupt processing flow provided by the embodiment of the present application;

[0049] Fig. 20 It is a comparative schematic diagram of the query rate per second of a 1G data set provided by an embodiment of the present application under a concurrency of 128;

[0050] Fig.21 It is a comparative schematic diagram of the query rate per second of a 10G data set provided in an embodiment of the present application at a concurrency of 128;

[0051] Fig. 22 It is a comparative schematic diagram of the query rate per second of a 100G data set provided in an embodiment of the present application at a concurrency of 128;

[0052] Fig.23 It is a comparative schematic diagram of power consumption of a 1G data set provided in an embodiment of the present application at a concurrency of 128;

[0053] Fig.24 It is a comparative schematic diagram of power consumption of a 10G data set provided in an embodiment of the present application at a concurrency of 128;

[0054] Fig.25 This is a comparative schematic diagram of the power consumption of a 100G data set at a concurrency of 128 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0056] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0057] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0059] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0060] 1) The Central Processing Unit (CPU) is the core of computer equipment's calculation and control, and is the final execution unit for information processing and program running.

[0061] 2) The processor core, also known as the processor core, is the most important component of the CPU. All CPU calculations, command reception / storage, and data processing are performed by the processor core. The processor components contained in the core are all involved in the operation of the central processing unit commands, including the Arithmetic Logic Unit (ALU), Floating Point Unit (FPU), Level 1 Cache (L1Cache), and Level 2 Cache (L2Cache).

[0062] 3) Uncore is the part of the CPU other than the processor core. Uncore functions include Quick Path Interconnect (QPI) controller, L3 Cache, Snoop Agent Pipeline, storage controller, etc.

[0063] 4) Simulate MultiThreading (SMT) refers to the simultaneous execution of multiple threads on a core, so that multiple threads can share the resources of the same core.

[0064] 5) A thread is the smallest unit in which an operating system can schedule operations.

[0065] 6) Load refers to the statistical information of threads that are in the running state and the runnable state within a period of time.

[0066] 7) Turbo Boost refers to a technology that automatically and intelligently adjusts the CPU frequency based on actual operating conditions after a program is started to improve performance, while keeping the CPU running within a limited power consumption, current, voltage and temperature range.

[0067] When computer equipment is running, it consumes certain resources, such as electrical energy. In order to save energy, some energy-saving technologies can be applied to the CPU so that the CPU runs in energy-saving mode, thereby reducing the energy consumption of the computer equipment.

[0068] For example, Figure 1 This is a schematic diagram of the CPU's energy-saving technology. Figure 1, the CPU includes a core part 1-1 and a non-core part 1-2. Among them, the core part 1-1 can include 4 processor cores 1-11, and two threads 1-12 are provided on each processor core 1-11. The non-core part 1-2 includes a three-level cache 1-21, a clock 1-22, a QPI controller 1-23 and an integrated memory controller (IMC) 1-24. Among them, the CPU energy-saving technologies applied to the processor core include CPU frequency modulation (Pstate) 1-3, CPU sleep (Cstate) 1-4 and Turbo Boost 1-5. The energy-saving technology applied to the non-core is controlled and implemented by the non-core frequency 1-6.

[0069] Figure 2 This is a schematic diagram of the framework of the CPU's energy-saving technology when it is implemented. Figure 2 The scheduling module 2-1 schedules the CPU sleep subsystem (CPU Idle) 2-2 when the CPU is idle. The control module 2-21 in the CPU sleep subsystem 2-2 will meet the needs of different scenarios through different sleep strategies (such as step-by-step sleep and specified level sleep strategies). Then the CPU sleep subsystem 2-2 drives the hardware 2-4 through the corresponding driver 2-22, thereby achieving Cstate adjustment. The scheduling module 2-1 schedules the CPU frequency modulation subsystem (CPU Freq) 2-3 when the CPU is loaded. The control module 2-31 of the CPU frequency modulation subsystem 2-3 will meet the needs of different scenarios through different frequency modulation strategies (such as maximum frequency, minimum frequency, on-demand frequency modulation and degree-scheduled frequency modulation). Then the CPU frequency modulation subsystem 2-3 drives the hardware 2-4 through the corresponding driver 2-32, thereby achieving Pstate adjustment. In addition, Turbo Boost 2-5 is also implemented through the CPU frequency modulation subsystem 2-3. In Turbo Boost mode, the CPU frequency modulation subsystem 2-3 is scheduled, and the corresponding driver 2-32 is called through the CPU frequency modulation subsystem 2-3 to drive the hardware 2-4, thereby realizing Turbo Boost.

[0070] There are also certain connections between different energy-saving technologies. Figure 3It is a schematic diagram of the relationship between different energy-saving technologies. For Cstate, the CPU sleep state can be divided into four states, namely C0, C1, C1E and C6. Among them, in the C0 state, the CPU will be in an active state (that is, it will execute instructions normally), the required core voltage 3-1 is the highest, the first / second cache 3-2 will be retained, and the wake-up time 3-3 is immediate wake-up; in the C1 state, the core voltage 3-1 is high, the first / second cache 3-2 will be retained, the wake-up time 3-3 is short, and the no-load power 3-4 is high; in the C1E state, the core voltage 3-1 is low, the first / second cache 3-2 will also be retained, the wake-up time 3-3 becomes longer, and the no-load power 3-4 is reduced; in the C6 state, the core voltage 3-1 is no longer required, the first / second cache 3-2 will be refreshed, the wake-up time 3-3 reaches the longest, and the no-load power 3-4 is further reduced. It can be seen that the devices related to different states of Cstate are different, and the time for different C states (that is, energy-saving states) to return to the C0 state is also different. Among them, multiple processor cores can be packaged into a unit. When the processor cores in the entire package unit are in an idle state, the package unit as a whole can enter a corresponding sleep state, such as entering the PC1E state (core voltage is turned off, the first / second level is retained, the wake-up time is longer, and the no-load power is lower), or the PC6 state (core voltage is turned off, the first / second level is refreshed, the wake-up time continues to be normal, and the no-load power continues to decrease) to complete the control of the package unit. When the CPU is in the C0 state, that is, when the CPU is in the active state, the frequency can be controlled by Pstate. Among them, the operating frequency of the CPU can be divided into n levels from P1 to Pn, among which the frequency of the P1 level is the highest, which is 2.3GHz, and the frequency of P1 to Pn gradually decreases, for example, the frequency of the P2 level is reduced to 2.2GHz. When the operating frequency of the CPU has reached the P1 level, the operating frequency of the CPU can be further increased through turbo acceleration. The CPU turbo frequency in turbo acceleration can be divided into n levels from P01 to P0n, among which the operating frequency of P01 is 2.9GHz, the operating frequency of P02 is also 2.9GHz, the operating frequency of P03 is 2.8GHz... and the operating frequency of P0n is 2.4GHz.

[0071] The following is a brief introduction to the implementation framework of different energy-saving technologies.

[0072] Cstate technology is used to control the power consumption of the CPU when it is idle. Since the exit delay of C state is large, it may affect the system performance. When the CPU is idle, the system will schedule the Idle process, and the Idle process calls the interface of the sleep subsystem to put the CPU to sleep. The sleep subsystem mainly consists of two parts: strategy and driver. The strategy part uses multiple strategies to meet the needs of different scenarios. Table 1 provides a description of different sleep strategies. Among them, the common way is to collect the system's load information, scheduling information, delay information, and interrupt information, and then predict the system's sleep time based on the collected information, and enter a specific sleep depth based on the predicted sleep time. The driver part is mainly responsible for driving the hardware. Among them, the common drivers are acpi_idle driver and intel_idle driver. The acpi_idle driver depends on the ACPI table, which is filled by the BIOS. If the BIOS prohibits Cstate related functions, the driver cannot be used normally; compared with the acpi_idle driver, the intel_idle driver does not depend on ACPI.

[0073] Table 1

[0074]

[0075] Figure 4 This is a schematic diagram of the implementation framework of the Cstate technology. The kernel 4-1 of the CPU sleep subsystem will first abstract the control module 4-2 and the driver module 4-3 of the sleep subsystem. The strategy part is implemented by the control module 4-2, that is, the main purpose of the control module 4-2 is to strike a balance between performance and power consumption based on the system status and the required data 4-4. The driver part is implemented by the driver module 4-3, that is, the driver module 4-3 calls the architecture (Arch) related code 4-5 to drive the hardware 4-6.

[0076] Pstate technology is mainly regulated through the CPU frequency modulation subsystem. The CPU frequency modulation subsystem can be divided into a policy part and a driver part. Among them, the policy part mainly implements a variety of frequency modulation strategies to meet the needs of different scenarios. Table 2 provides a description of different strategies. Among them, a common way is to collect system load information, scheduling information, delay information, and interrupt information, and then predict the system load and adjust the CPU frequency according to the load conditions. The driver part implements the driver for the hardware. In actual application scenarios, the two common drivers of the CPU frequency modulation subsystem are the acpi_freq driver and the intel_pstate driver. Among them, the intel_pstate driver has a higher priority and will be used first; acpi_freq depends on the ACPI table, which is generally filled by the BIOS. If the BIOS disables frequency modulation, the acpi_freq driver will not be used normally.

[0077] Table 2

[0078]

[0079] For example, Figure 5 It is a schematic diagram of the implementation framework of the Pstate technology. The core 5-1 of the CPU frequency modulation subsystem will first abstract the control module 5-2 and the driver module 5-3 of the frequency modulation subsystem. The strategy part is implemented by the control module 5-2, that is, the main purpose of the control module 5-2 is to adjust the CPU main frequency according to the system status and the required data 5-4. The driver part is implemented by the driver module 5-3, that is, the driver module 5-3 calls the architecture (Arch) related code 5-5 to drive the hardware 5-6.

[0080] Turbo Boost allows the CPU to run at the base clock rate when lightly loaded and increase to a higher clock rate when heavily loaded. Running at the base clock rate (the number of cycles executed per second) allows the CPU to consume less power, thereby reducing heat, and when a higher rate is needed, Turbo Boost dynamically increases the clock rate to compensate (this approach can also be called "algorithmic overclocking"). In other words, Turbo Boost mode can increase the CPU's processing speed to the highest Turbo Boost within safe temperature and power limits, thereby improving the performance of single-threaded and multi-threaded applications.

[0081] For example, Figure 6 It is a schematic diagram of the framework of Turbo Boost technology. The operating frequencies of P1 to Pn are controlled by the system 6-1, that is, by the driver module of the CPU frequency modulation subsystem. When the frequency is at the highest frequency P1, the hardware Turbo Boost 6-2 will start. For example, the operating frequency of the processor core whose frequency has reached P1 will continue to increase to P0n or even P01. The highest frequency of Turbo Boost depends on the number of active processor cores, or on the number of processor cores at P1 to Pn. Therefore, Turbo Boost can be simply understood as a part of the processor core giving up power to the Turbo Boost processor core while the total power remains unchanged, so that the Turbo Boost processor core can be at a higher frequency. Of course, if all processor cores are at the highest frequency P1, then all processor cores will be at the same Turbo Boost frequency.

[0082] As can be seen from the above introduction, in the related technologies, the energy-saving state of a single CPU is dynamically adjusted based on the load of a single CPU, that is, the energy-saving state is adjusted based on the granularity of the CPU load. However, the load of a single CPU is very easy to change. If a pending task appears after entering the energy-saving state, it is necessary to exit from the energy-saving state to the active state for processing, and the exit from the energy-saving state usually takes a certain amount of time to complete the response. For example, there will be a certain time delay when waking up the processor core from a higher-level sleep state to the active state, so it takes a long time to complete the processing of the pending task, which will affect the operating performance of the computer device. It can be seen from this that in the related technologies, when saving energy on computer equipment, the operating performance of the computer equipment system will be affected, that is, it is impossible to both ensure the operating performance of the computer equipment and achieve energy saving on the computer equipment.

[0083] The embodiments of the present application provide a processor scheduling method, apparatus, device, computer-readable storage medium, and computer program product, which can both ensure the state of the operating performance of the computer device and save energy for the computer device. The following describes an exemplary application of the computer device provided by the embodiments of the present application. The computer device provided by the embodiments of the present application can be implemented as various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, mobile devices, etc., and can also be implemented as a server. Below, an exemplary application when the computer device is implemented as a server will be described.

[0084] See also Figure 7 , Figure 7 1 is a schematic diagram of the architecture of the processor scheduling system provided in the embodiment of the present application. In order to support a processor scheduling application, in the processor scheduling system 100, the terminal (exemplarily showing the terminal 400-1 and the terminal 400-2) is connected to the server 200 via the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two. A database 500 is also provided in the processor scheduling system 100 for providing data support to the server 200. The database 500 can be independent of the server 200, or it can be integrated in the server 200. Figure 7 The illustrated case is that the database 500 is independent of the server 200 .

[0085] Server 200 is used to receive data pull requests sent by terminal 400-1 and terminal 400-2, and decompose the data sending process for terminal 400-1 and terminal 400-2 into tasks to be processed; perform load statistics on N processors to obtain the total load of the N processors; based on the total load of the N processors, generate corresponding processor bitmaps for the N processors, wherein the processor bitmap is used to distinguish between active processors and idle processors among the N processors; based on the processor bitmap, concentrate the tasks to be processed in the active processors for processing, and adjust the idle processors to the target energy-saving mode, complete the scheduling of the N processors, and return the feedback data of the data pull request to terminal 400-1 and terminal 400-2.

[0086] The terminal 400 - 1 and the terminal 400 - 2 are used to display the feedback data sent by the server 200 on the data display interfaces displayed on the graphic interface 410 - 1 and the graphic interface 410 - 2 respectively, for users to view.

[0087] The embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.

[0088] Cloud computing is a general term for network technology, information technology, integration technology, management platform, and application technology based on the cloud computing business model. It can form a resource pool and be used on demand, which is flexible and convenient. Cloud computing technology will become an important support. The system background services of the technical network require a large amount of computing and storage resources, which need to be realized through cloud computing.

[0089] Exemplarily, server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Terminals 400-1 and 400-2 may be smart phones, tablet computers, laptops, desktop computers, smart speakers, smart watches, smart home appliances, car terminals, etc., but are not limited thereto. The terminals and servers may be directly or indirectly connected via wired or wireless communications, which is not limited in the embodiments of the present application.

[0090] See also Figure 8 , Figure 8 The embodiment of this application provides Figure 1 A schematic diagram of the structure of a server (an implementation of a computer device) in FIG. Figure 8The server 200 shown includes: N processors 210 (N ≥ 2), a memory 250, at least one network interface 220, and a user interface 230. The various components in the server 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 240 is not described in detail. Figure 8 Various buses are labeled as bus system 240 .

[0091] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0092] The user interface 230 includes one or more output devices 231 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 230 also includes one or more input devices 232, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0093] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 210.

[0094] The memory 250 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 250 described in the embodiments of the present application is intended to include any suitable type of memory.

[0095] In some embodiments, memory 250 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0096] Operating system 251, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0097] A network communication module 252, used to reach other computing devices via one or more (wired or wireless) network interfaces 220, exemplary network interfaces 220 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);

[0098] a presentation module 253 for enabling presentation of information via one or more output devices 231 (e.g., display screen, speaker, etc.) associated with the user interface 230 (e.g., a user interface for operating peripherals and displaying content and information);

[0099] The input processing module 254 is used to detect one or more user inputs or interactions from one of the one or more input devices 232 and translate the detected inputs or interactions.

[0100] In some embodiments, the processor scheduling device provided in the embodiments of the present application can be implemented in software. Figure 8 The processor scheduling device 255 stored in the memory 250 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a load statistics module 2551, a bitmap generation module 2552, a processor control module 2553, an interrupt migration module 2554 and a frequency setting module 2555. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0101] In other embodiments, the processor scheduling device provided in the embodiments of the present application can be implemented in hardware. As an example, the processor scheduling device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the processor scheduling method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0102] In some embodiments, a terminal or server (both are possible implementations of computer devices) can implement the processor scheduling method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a power management APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0103] The embodiments of the present application can be applied to processor scheduling scenarios of computer devices such as terminals and servers. Below, the processor scheduling method provided by the embodiments of the present application will be described in conjunction with the exemplary application and implementation of the computer device provided by the embodiments of the present application.

[0104] See also Fig. 9 , Fig. 9 This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 1 , will combine Fig. 9 The steps shown are explained.

[0105] S101. Perform load statistics on N processors to obtain the total load of the N processors.

[0106] The embodiment of the present application is implemented in the scenario of scheduling the work of N processors in a computer device, so as to ensure the operating performance of the computer device and save energy for the computer device. In the embodiment of the present application, the computer device first calculates the load for each processor it has, and calculates the total load of the N processors to obtain the total load of the N processors. It should be noted that N≥2, that is, in the embodiment of the present application, the computer device schedules the work of at least two processors it has.

[0107] It can be understood that the load of each processor refers to the statistical information of the threads of each processor that are in the running state and the runnable state. Therefore, the load of each processor can preliminarily reflect the computing resources required by each processor, that is, the computing power.

[0108] The processor in the embodiment of the present application may refer to a central processing unit (CPU) or a graphics processing unit (GPU), which is not limited in the embodiment of the present application.

[0109] In some embodiments of the present application, Fig. 9S101 in the figure, i.e., the process of performing load statistics on N processors to obtain the total load of the N processors, can be implemented by the following processing: performing load sampling on each processor to obtain the load information of each processor; and accumulating the N load information corresponding to the N processors to obtain the total load of the N processors.

[0110] The computer device may perform load sampling on each processor through an existing load sampling algorithm (such as the PELT algorithm, the WALT algorithm, etc.) to obtain corresponding load information. The computer device may also complete load sampling by reading the power consumption of each processor and then determining corresponding load information for each processor based on the corresponding relationship between power consumption and load.

[0111] S102: Generate corresponding processor bitmaps for the N processors based on the total load of the N processors.

[0112] The computer device divides N processors into idle processors and active processors based on the total load obtained by statistics, that is, the active processor is determined from the N processors, and the remaining processors except the active processor are determined as idle processors. Then, a bitmap is generated using the processor identifiers corresponding to the N processors, and different marking methods are used in the bitmap to mark the processor identifiers of the active processors and the idle processors, and the marked bitmap is determined as the processor bitmap. Therefore, the obtained processor bitmap is used to distinguish the active processors and the idle processors among the N processors.

[0113] It should be noted that an active processor refers to a processor that needs to remain active in the future (i.e., for a period of time in the future), and can be used to quickly respond to subsequent pending tasks and process pending tasks. Therefore, all subsequent pending tasks can be concentrated on the active processor for processing, and the corresponding operating frequency can be set for it to ensure the task processing performance of the computer device. An idle processor is a processor that needs to remain idle in the future, that is, it will not participate in the processing of any pending tasks in the future. Therefore, these idle processors can be directly adjusted to the required energy-saving mode, such as the controller entering deep sleep, or controlling it to run at the lowest frequency, etc., to save energy consumption of the computer device.

[0114] It is understandable that in the embodiment of the present application, the number of active processors is proportional to the total load of the N processors, while the number of idle processors is inversely proportional to the total load of the N processors. If the computer device divides the N processors into M active processors and NM idle processors, as the total load increases, M will gradually increase (1≤M≤N), and NM will gradually decrease.

[0115] The computer device can generate a processor bitmap in a variety of different ways. The generation process of the processor bitmap is described below.

[0116] See also Fig.10 , Fig.10 This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 2 In some embodiments of the present application, Fig. 9 S102 in the embodiment, i.e., generating corresponding processor bitmaps for the N processors based on the total load of the N processors, can be implemented through S1021-S1024 as follows:

[0117] S1021. Perform filtering processing on the total load of N processors to obtain a filtered load.

[0118] Since the load of each processor does not change smoothly, for example, at a certain moment the load will suddenly increase and then suddenly decrease, which may cause the load of each processor to fluctuate greatly. Although the oscillation can be eliminated to a certain extent by superimposing the loads of N processors (that is, the peaks and troughs cancel each other out), it is impossible to completely eliminate the oscillation, which makes the total load uneven. The uneven total load will lead to the need to frequently generate processor bitmaps (in fact, the sudden change in the total load is very short-term, and there is no need to divide the active processors and idle processors additionally). Therefore, in order to minimize the number of unnecessary processor bitmap generation, the computer device will filter the total load to make it smoother, thereby obtaining the filtered load.

[0119] In some embodiments of the present application, the computer device may filter the total load by historical load. Fig.10 In S1021, filtering the total load of the N processors to obtain the filtered load can be achieved by the following processing: obtaining the historical load, and weighting and fusing the historical load and the total load to complete the filtering of the total load to obtain the filtered load. It should be noted that the weighted weight of the historical load is greater than the weighted weight of the total load.

[0120] That is to say, in the embodiment of the present application, the computer device calculates a smoother load through the historical load at the historical time and the total load obtained by the current statistics to obtain the filtered load. Since the difference between the historical load and the real load at the current time is not very large, a larger weight is assigned to the historical load and a smaller weight is assigned to the total load, so that the historical load can be considered more in the calculation process of the smoothed load, thereby ensuring the accuracy of the filtered load.

[0121] In other embodiments of the present application, the computer device can also filter the total load through some commonly used filtering algorithms, for example, filtering the total load through a mean filtering algorithm, or filtering the total load with a limiting filtering algorithm, etc. The embodiments of the present application are not limited here.

[0122] S1022. Determine the target computing power corresponding to the total load based on the filtered load.

[0123] After obtaining a smoother filter load, the computer device will determine the total computing power required to process the total load based on the filter load, and determine the total computing power as the target computing power for the total load. It should be noted that when determining the target computing power, the computer device can determine the target computing power only based on the filter load, or it can consider other factors on the basis of the filter load, such as computing power fluctuations, to determine the final target computing power.

[0124] In some embodiments of the present application, Fig.10 S1022, i.e., determining the target computing power corresponding to the total load based on the filter load, can be achieved by the following processing: determining the corresponding matching computing power for the filter load, and determining the matching computing power as the target computing power corresponding to the total load.

[0125] That is, the computer device can directly use the matching computing power corresponding to the filter load, that is, the computing power required to process the filter load (which can be the number of threads required to process the filter load, or 1.5 times the number of threads), as the target computing power for the total load. In this way, the target computing power can just meet the processing of the total load, so that the computing power will not be wasted.

[0126] In other embodiments of the present application, Fig.10 S1022, i.e., determining the target computing power corresponding to the total load based on the filtered load, can also be achieved by the following processing: determining the corresponding matching computing power and reserved computing power for the filtered load; superimposing the matching computing power and the reserved computing power to obtain the superimposed computing power; adding the fluctuating computing power corresponding to the load fluctuation to the superimposed computing power, and determining the computing power after adding the fluctuating computing power as the target computing power corresponding to the total load.

[0127] Among them, the reserved computing power refers to the computing power that the processor needs to have in addition to processing the filter load. The reserved computing power can be calculated by the matching computing power of the filter load and the utilization of the processor. For example, when the matching computing power of the filter load is Cma and the processor utilization is 50%, the reserved computing power can be Cma. It should be noted that the computer equipment considers the reserved computing power in determining the target computing power in order to cope with emergencies of a single processor, such as processor congestion, to ensure that the processor can operate normally.

[0128] In addition, the computer device also needs to consider the fluctuation of the load, that is, by adding fluctuating computing power to cope with the load fluctuation. The fluctuating computing power can be a preset value or the average of the total load and the filter load, which is not limited in the embodiment of the present application.

[0129] It can be understood that in the embodiment of the present application, by simultaneously considering the matching computing power, reserved computing power and fluctuating computing power of the filtering load to determine the final target computing power, it is possible to ensure that a more sufficient target computing power is obtained for the total load, thereby ensuring that a sufficient number of active processors can be obtained, thereby ensuring the operating performance of the computer device.

[0130] S1023. Based on the target computing power and the rated computing power of each processor, determine M active processors and NM idle processors from the N processors.

[0131] After obtaining the target computing power, the computer device will read the rated computing power of each processor, that is, the maximum computing power of each processor, and then determine how many processors are needed to achieve the target computing power based on the target computing power and the read rated computing power, that is, determine the number of active processors M. Then, the computer device will select M processors from N processors as active processors and the remaining NM processors as idle processors, thereby completing the division of N processors into active processors and idle processors. Among them, 1≤M <N。

[0132] In some embodiments of the present application, Fig.10 S1023 in it, i.e., the implementation process of determining M active processors and NM idle processors from N processors based on the target computing power and the rated computing power of each processor, can be implemented by the following processing: according to the target computing power and the rated computing power of each processor, the number of first processors required to achieve the target computing power is calculated; according to the number of tasks corresponding to the total load and the task queuing capacity of each processor, the number of second processors required for the number of tasks is calculated; the largest number of processors between the first number of processors and the second number of processors is determined as the number M of active processors; the M processors with the highest load among the N processors are determined as active processors, and the remaining NM processors are determined as idle processors.

[0133] That is to say, the computer device first determines how many processors are needed to reach the target computing power by reading the rated computing power of each processor. Therefore, when the rated computing power of each processor is the same, the first number of processors is the ratio of the target computing power to the rated computing power. When the rated computing power of each processor is different, the rated computing power can be sorted in order from large to small, and then the rated computing power is superimposed from the head of the sequence until the superposition result reaches or exceeds the target computing power, and the number of all processors participating in the superposition is used as the first number of processors.

[0134] The task queuing capacity of each processor refers to the maximum number of tasks that can be queued on the processor. For example, when the task queuing capacity of a processor is 2, it means that at most two tasks (i.e., processes) can be queued on the processor to wait for processing by the processor. If the task queuing capacity is larger, the last task in the queue will take longer to wait for processing, which will also affect the operating performance of the computer device. Therefore, the computer device also needs to obtain the number of tasks corresponding to the total load, that is, to count the number of tasks required to cause the total load, and then consider the number of tasks and the task queuing capacity of each processor at the same time, determine the number of processors required to complete the processing of these tasks, and thus obtain the second number of processors.

[0135] Next, the computer device selects the largest number of processors from the first number of processors and the second number of processors as the number of active processors M, thereby ensuring that the number of active processors is more sufficient. Finally, the computer device selects the M processors with the highest load from the N processors (the reason for selecting the M processors with the highest load is that the processors with high load need longer time to enter the energy saving mode than the processors with low load) as the active processors to complete the division of active processors and idle processors.

[0136] Of course, in other embodiments of the present application, Fig.10 S1023 in the above, i.e., the process of determining M active processors and NM idle processors from N processors based on the target computing power and the rated computing power of each processor, can also be implemented by the following processing: according to the target computing power and the rated computing power of each processor, the first number of processors required to achieve the target computing power is calculated; the first number of processors is determined as the number M of active processors; M processors are randomly selected from the N processors and determined as active processors, and the remaining NM processors are determined as idle processors.

[0137] That is, the computer device can directly determine the number of active processors based only on the target computing power and the rated computing power of each processor without considering other factors, making the process of determining the number M of active processors simpler and faster.

[0138] S1024, generating an initial bitmap for N processors, and marking the processor identifiers of M active processors in the initial bitmap with a first mark, and marking the processor identifiers of NM idle processors in the initial bitmap with a second mark, to obtain a processor bitmap.

[0139] The computer device first generates an initial bitmap using the processor identifiers (e.g., processor names, processor IDs) corresponding to each of the N processors, so that the obtained initial bitmap can be regarded as an array or queue composed of the processor identifiers corresponding to each of the N processors. Next, the computer device locates the processor identifier of each active processor from the initial bitmap, and marks these processor identifiers with a first mark, and then marks the processor identifiers of the idle processors, that is, the remaining processor identifiers, with a second mark. After completing the marking of each processor identifier in the initial bitmap, the computer device obtains a processor bitmap.

[0140] It should be noted that in the embodiment of the present application, the first mark and the second mark can be two different numerical values, for example, the first mark is 1 and the second mark is 0. The first mark and the second mark can also be two different logical values, for example, the first mark is true and the second mark is false.

[0141] In some embodiments, the first mark and the second mark can be written directly on the initial bitmap, so that each bit of the processor bitmap obtained contains two elements, namely, the processor identifier and its corresponding mark. In other embodiments, the first mark and the second mark can be recorded through a mask bitmap of the same size as the initial bitmap, that is, each bit in the initial bitmap is the processor identifier, and each bit in the mask bitmap is the mark corresponding to the processor identifier, so that the processor bitmap can be composed of two bitmaps, the initial bitmap and the mask bitmap.

[0142] It can be understood that in the embodiment of the present application, the computer device filters the total load, and then uses the obtained filtered load to determine the target computing power, and divides the active processors and idle processors into two groups by comprehensively considering the target computing power and the rated computing power. This not only makes the number of active processors more sufficient to bear the total load and ensure the accuracy of the processor bitmap, but also reduces the impact of the processor load fluctuation on the division of active processors and idle processors, thereby reducing unnecessary processor bitmap generation process.

[0143] In other embodiments of the present application, Fig. 9 S102, i.e., generating corresponding processor bitmaps for N processors based on the total load of N processors, can also be achieved by the following processing: performing difference calculation between the total load of N processors and multiple historical load totals corresponding to multiple historical bitmaps, and determining the historical bitmap corresponding to the historical load total whose total difference is less than the difference threshold as the processor bitmap corresponding to the N processors.

[0144] S103 . Based on the processor bitmap, the tasks to be processed are concentrated on the active processors for processing, and the idle processors are adjusted to the target energy-saving mode, thereby completing the scheduling of the N processors.

[0145] After obtaining the processor bitmap, the computer device will select the active processor through the marks corresponding to the different processor identifiers in the processor bitmap, and assign the pending tasks to the active processor for processing. The idle processor does not need to process the pending tasks and will remain idle. The computer device will adjust it to the target energy-saving mode to reduce energy consumption.

[0146] It should be noted that the target energy-saving mode can be set according to actual needs. The target energy-saving mode in the embodiment of the present application can refer to the deepest sleep, or the processor frequency can be adjusted to the lowest frequency, or other modes that can achieve energy saving, etc.

[0147] In some embodiments, the active processor runs in the highest performance mode, the processor frequency of the highest performance mode is the highest frequency, and the sleep depth is the lowest depth; the processor frequency of the target energy saving mode is the lowest frequency, and the sleep depth is the highest depth. In other embodiments, the active processor runs in a specified performance mode, the processor frequency of the specified performance mode is the specified frequency, and the sleep depth is the lowest depth; the processor frequency of the target energy saving mode is the lowest frequency, and the sleep depth is the specified depth.

[0148] It is understandable that, compared with the related art, when the energy-saving state is adjusted based on the load of a single CPU, the operating performance of the computer device will be affected, that is, it is impossible to achieve energy saving of the computer device while ensuring the operating performance of the computer device. In the embodiment of the present application, the computer device will generate a processor bitmap for distinguishing the active processors and idle processors in the N processors through the total load of the N processors, so as to achieve the global load as the granularity, and divide the N processors into active processors and idle processors, and by concentrating the tasks to be processed in the active processors for processing, it is possible to quickly respond to the tasks to be processed, thereby ensuring the processing performance of the computer device, and at the same time directly adjusting the idle processor to the target energy-saving mode, so that the idle processor can be in a low-power state all the time, so as to achieve energy saving of the computer device. In this way, it is achieved that the operating performance of the computer device can be guaranteed, and the computer device can be saved. In addition, in the embodiment of the present application, the computer device reduces the time required for the trade-off between performance and power consumption by directly adjusting the idle processor to the target energy-saving mode, thereby reducing the time required for the computer device to achieve energy saving.

[0149] based on Fig. 9 , see Fig.11 , Fig.11 This is a flowchart of the processor scheduling method provided in the embodiment of the present application. Figure 3 In some embodiments of the present application, Fig. 9 After S102, that is, after generating corresponding processor bitmaps for the N processors based on the total load of the N processors, the method may further include the following processing: S104-S105, as follows:

[0150] S104: Determine a corresponding mapping processor for an idle processor based on the processor bitmap.

[0151] Since the idle processor needs to be adjusted to the target energy-saving mode in the subsequent time to save energy, the idle processor will not respond to the interrupt, similar to the pending tasks. Therefore, after determining the idle processor, the computer device needs to combine the processor bitmap and determine a mapping processor that can handle the interrupt on each idle processor from the active processors.

[0152] In some embodiments of the present application, Fig.11S104, i.e., the process of determining the corresponding mapping processor for the idle processor based on the processor bitmap, can be implemented by the following processing: removing the processor identifiers of the idle processors in the processor bitmap to obtain a sparse bitmap; calculating the identifier remainder of the length of the bitmap array for the processor identifiers of the idle processors; filtering out the target identifier corresponding to the identifier remainder from the bitmap array, and determining the active processor corresponding to the target identifier as the mapping processor.

[0153] The computer device locates the processor identifier of the idle processor from the processor bitmap, and deletes the processor identifier from the processor bitmap. The bitmap that completes the deletion operation is the sparse bitmap. Then, the computer device rearranges the sparse bitmap into a compact array, which is the bitmap array, that is, the bitmap array is an array obtained by compactly arranging the sparse bitmap, and calculates the remainder of the processor identifier of the idle processor with the length of the obtained bitmap array. Finally, according to the identifier remainder, the processor identifier corresponding to the identifier remainder is re-indexed from the bitmap array as the target identifier, and the active processor corresponding to the target identifier is selected as the mapping processor.

[0154] For example, if the processor bitmap is [0,1,2,3,4,5,6,7,8,9], where the processor identifier of the idle processor is 3, then the sparse bitmap is the bitmap after removing 3, and the corresponding bitmap array is [0,1,2,4,5,6,7,8,9]. The computer device calculates the remainder of 3 relative to the length of the bitmap array of the sparse bitmap, that is, 9, and the obtained identifier remainder is 3. Finally, the computer device uses the obtained identifier remainder to re-index the processor identifier from the bitmap array (that is, the processor identifier with the same index as the original position of 3), and the obtained target identifier is 4. Therefore, the active processor with processor identifier 4 is the mapping processor of the idle processor.

[0155] In some embodiments of the present application, Fig.11 S104, i.e., the process of determining the corresponding mapping processor for the idle processor based on the processor bitmap, can also be implemented by the following processing: removing the processor identifiers of the idle processors in the processor bitmap to obtain a sparse bitmap; determining any processor identifier in the sparse bitmap as the target identifier, and determining the active processor corresponding to the target identifier as the mapping processor.

[0156] That is, the computer device can select any mapping processor from the existing active processors as the idle processor to complete the mapping processor determination process.

[0157] S105 , processing the interrupt on the idle processor through the mapping processor, and adjusting the idle processor to the target energy-saving mode.

[0158] Then, when the interrupt originally bound to the idle processor is triggered, the computer device will migrate the interrupt to the mapping processor for processing, so that all interrupts are limited to be processed on the active processor and the idle processor is adjusted to the target energy-saving mode to achieve energy saving.

[0159] In some embodiments of the present application, Fig.11 In S105, processing the interrupt on the idle processor through the mapping processor can be achieved through the following processing: processing the network card interrupt on the idle processor through the mapping processor to obtain the data packet of the network card interrupt; distributing the data packet on N processors; when the data packet is distributed to the idle processor, migrating the data packet to the mapping processor, and performing soft interrupt processing on the data packet through the mapping processor.

[0160] In the embodiment of the present application, the computer device will re-affinity the network card interrupt originally bound to the idle processor to the corresponding mapping processor for processing to generate a corresponding data packet, and then continue to distribute the data packet on different processors to process the soft interrupt. When the data packet is distributed to the idle processor, the computer device will affinity the data packet to the mapping processor to implement the soft interrupt. In other words, for the network card interrupt and soft interrupt on the idle processor, the computer device will re-affinity them to the mapping data packet respectively to complete the corresponding processing.

[0161] In other embodiments of the present application, Fig.11 In S105, processing the interrupt on the idle processor by mapping the processor can also be achieved by the following processing: processing only the network card interrupt on the idle processor by mapping the processor to obtain the data packet of the network card interrupt; distributing the data packet to any active processor for processing the soft interrupt.

[0162] It can be understood that in the embodiment of the present application, the computer device determines a corresponding mapping processor for the idle processor and re-affinity the interrupt bound to the idle processor to the corresponding mapping processor for processing, thereby ensuring that the interrupt originally bound to the idle processor is correctly responded to, thereby ensuring the success rate of interrupt execution.

[0163] In some embodiments of the present application, based on the processor bitmap, the tasks to be processed are concentrated on the active processors for processing, and the idle processors are adjusted to the target energy-saving mode. The method may also include the following processing: through the maximum frequency parameter, the maximum frequency of the active processor when turbo is set.

[0164] This is because, when the processor is turbo-clocked, the maximum turbo-clocked frequency will change with the number of turbo-clocked processors. For example, when the number of turbo-clocked processors increases, the maximum turbo-clocked frequency will decrease, and when the number of turbo-clocked processors decreases, the maximum turbo-clocked frequency will increase. In the embodiment of the present application, since only the active processor runs at the highest frequency and meets the turbo-clocking conditions, only the number of active processors, that is, M processors, participate in turbo-clocking at most, which will increase the maximum turbo-clocking frequency. However, the increase in the maximum turbo-clocking frequency is not conducive to power consumption control. Therefore, the computer device will limit the maximum frequency of the active processor when turbo-clocked through the maximum frequency parameter, so as to facilitate power consumption control for the active processor and help save energy for the computer device.

[0165] It should be noted that the maximum frequency parameter can be set according to actual needs, for example, set to 2.8 GHz, or set to 3.0 GHz, etc., and the embodiments of the present application are not limited here.

[0166] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0167] The embodiment of the present application is implemented in a scenario where a server (referred to as a computer device) schedules a CPU, so as to ensure the operating performance of the server and save energy on the server.

[0168] Fig.12 Schematic diagram of the CPU scheduling framework of the server provided in the embodiment of the present application. Fig.12 The scheduling framework includes a scheduling module 12-1, a flexible strategy module 12-2, and an active CPU position Figure 12-3 (called processor bitmap), CPU frequency modulation subsystem 12-4, CPU sleep subsystem 12-5, interrupt migration module 12-6, turbo frequency maximum frequency control module 12-7. Among them, the scheduling module 12-1 calls the elastic strategy module 12-2 to generate active CPU bitmap according to the load of all CPUs. Figure 12-3 , then based on the active CPU bit Figure 12-3 The CPU frequency modulation subsystem 12-4, the CPU sleep subsystem 12-5, the interrupt migration module 12-6 and the turbo frequency maximum frequency control module 12-7 are scheduled. Figure 12-3It will affect the Completely Fair Scheduler (CFS Scheduler) 12-11 and the Real-time Scheduler (POSIX Realtime Scheduler, RT Scheduler) 12-12 in the scheduling module 12-1. These two schedulers call the control module 12-41 in the CPU frequency modulation subsystem 12-4 to select the elastic frequency modulation strategy from different frequency modulation strategies (such as maximum frequency, minimum frequency, on-demand frequency modulation, degree-scheduled frequency modulation and elastic frequency modulation) for frequency modulation, and drive the hardware 12-8 through the corresponding driver 12-42; call the control module 12-51 in the CPU sleep subsystem to select the elastic sleep strategy from different sleep strategies (such as step-by-step sleep, specified level sleep and elastic sleep) for sleep control, and drive the hardware 12-8 through the corresponding driver 12-52. The interrupt migration module 12-6 controls the active CPU bit according to the active CPU bit. Figure 12-3 Migrate the interrupt on the idle CPU and call the hardware 12-8 to implement the interrupt; the turbo maximum frequency control module 12-7 calls the CPU frequency modulation subsystem 12-4, and drives the hardware 12-8 through its driver 12-42, so as to control the maximum frequency during turbo.

[0169] The elastic policy module calculates the total CPU load (called the total load) based on the PELT algorithm, and then calculates the active CPU bitmap. Fig.13A 13 , the elastic strategy module first performs a power sampling 13 - 1 on the CPU to obtain the power C of each CPU. CPU (called processor load information), and then the total computing power of the system C is calculated by adding 13-2. total =∑C CPU (called the total load); then, the total computing power obtained by statistics is filtered 13-3, that is, (Where C on the left side of the equation ma is called the filter load, and C on the right side of the equation ma It is called historical load, that is, using the historical moment C ma Filter and get the new C ma );Then, calculate the target computing power C t =C ma +C reserve +|δC|, where C reserve Take C ma Reserve twice the computing power (called reserved computing power), or consider the CPU utilization rate to be 50%. δC represents the fluctuation, which can be taken as C total -C maThe arithmetic mean of |δC| is called the fluctuating computing power; then, the target number of cores N is determined based on the target computing power. 1 =roundup{C t / C}(N 1 It is called the first processor number, C represents the maximum computing power of each core, also called the rated computing power, which is read by the kernel), that is, scaling the core 13-4, that is, when the target computing power is high, more cores are activated, and when the target computing power is low, more cores are dormant; finally, the maximum queuing capacity of each core (called task queuing capacity) needs to be considered to define the target number of cores N 2 =roundup{T 总 / 2}(N 2 is called the number of second processors, T 总 Identifies the total number of queued processes, also known as the number of tasks, 2 is the task queuing capacity); the final total number of active cores (called the number of active processors M) takes max{N 1 ,N 2}; Finally, based on the calculated total number of active cores, the CPU with the highest load in the system is selected to generate an active CPU bitmap 13-5.

[0170] Fig. 13B This is a schematic diagram of the process of selecting a CPU provided by an embodiment of the present application. The server 13-6 has 10 CPUs, and the load of each CPU is 10%. According to the load 13-7 of all CPUs and the utilization rate of the CPU, it can be preliminarily determined that 2 CPUs need to be selected as active CPUs. Then, considering the impact of computing power fluctuations 13-8, the number of active CPUs will be increased to 3. Finally, considering the impact of the number of tasks that can be queued for each CPU 13-9, the number of active CPUs will be increased to 5 to obtain an active CPU bitmap. Finally, based on the active CPU bitmap, these tasks are assigned to 5 active CPUs for processing, and the sleep level of the idle CPU is adjusted to C6, and the frequency is adjusted to the lowest.

[0171] Through the active CPU bitmap, tasks can only be scheduled to active CPUs.

[0172] For example, Fig.14It is a comparative schematic diagram of task scheduling based on load balancing and task scheduling based on active CPU bitmap provided by the embodiment of the present application. When scheduling tasks based on load balancing, the CFS scheduler 14-2 will select cores for task 14-1 according to the principle of load balancing, so that each CPU may be selected (node ​​0 and node 1 in the figure are nodes encapsulated by 3 CPUs respectively); and when scheduling tasks based on the active CPU bitmap (i.e., the task scheduling method required to be adopted in the embodiment of the present application), the CFS scheduler 14-2 will select cores for task 14-1 according to the principle of avoiding selecting dormant cores (called idle processors), that is, when the CPU is a dormant core, the CFS scheduler 14-2 will only select cores from active cores.

[0173] The CPU sleep subsystem is used to limit the deepest sleep depth of active cores (called active processors) to C1 to ensure performance and limit the sleeping cores to the deepest sleep depth. Fig.15 is a comparison diagram of limiting the sleep depth of dormant cores provided in an embodiment of the present application. Fig.15 In the related art, the CPU sleep subsystem 15-2 is scheduled for CPU 15-1, and the CPU sleep subsystem 15-2 checks the system status 15-3 and determines whether the CPU needs to sleep 15-4. If yes, the target C state 15-5 is set for the CPU, and the CPU is put into sleep by executing the mwait instruction to become a sleep core 15-6. If no, the CPU is maintained in a prohibited sleep state 15-7 to become an active core 15-8. In the scheme of the embodiment of the present application, the process of checking the system status 15-3 is omitted, and it is determined whether the CPU needs to sleep 15-4. If yes, the maximum C state (called the highest sleep depth) 15-9 is set for the CPU, and the CPU is put into sleep by executing the mwait instruction to become a sleep core 15-6. If no, the CPU is maintained in a prohibited sleep state 15-7 to become an active core 15-8.

[0174] The CPU frequency adjustment subsystem is used to adjust the CPU frequency of the active core to the highest frequency and the CPU frequency of the dormant core to the lowest frequency. Fig.15 The process is similar.

[0175] The turbo frequency maximum frequency control module controls the maximum frequency of the CPU when it is turbo-clocked through parameters (called maximum frequency parameters). For example, Fig.16 Schematic diagram of the change of the highest frequency during turbo frequency provided in the embodiment of the present application. Fig.16As the number of turbo cores increases, the maximum turbo frequency will gradually decrease, that is, from frequency level 1 to frequency level 3. For example, when the number of turbo cores increases to 24, the maximum frequency will decrease to frequency level 3, that is, 2.4GHz. Conversely, when the number of turbo cores decreases, the maximum turbo frequency increases. In order to save energy, the maximum turbo frequency needs to be controlled.

[0176] The interrupt migration module limits the CPU interrupt to the active core through the active CPU bitmap. Fig.17 It is a comparative schematic diagram of interrupt limitation provided by the embodiment of the present application. When limiting interrupts based on the relevant technology, for interrupts in queue 17-1, both active core 17-2 (i.e., CPU0 and CPU1) and dormant core 17-3 (CPU2) need to respond to process; while in the technology of the embodiment of the present application, for interrupts in queue 17-1, if they are bound to dormant cores, they need to be migrated to active cores for processing. In this way, dormant cores can remain in dormant state.

[0177] Fig.18 It is a schematic diagram of the interrupt migration process provided by an embodiment of the present application. When CPU3 is in an inactive state, the server system will obtain a discontinuous active CPU bitmap (called a sparse bitmap) 18-1, and rearrange the bitmap to generate an array cpu_map (called a bitmap array), whose specific content is {0,1,2,4,5,6,7,8,9}; then, the server system uses the originally specified CPU (called the processor identifier of the idle processor) to perform a remainder index on cpu_map, that is, perform the processing of new_cpu=cpu_map[old_cpu%9] to obtain the remapped CPU (called a mapped processor), for example, the interrupt affinity of the original CPU3 is re-affinityed to CPU4 according to the algorithm cpu_map[3]=4. See. Fig.18 For the network card interrupt 18-2, the server system will affinity it to CPU4. For the dormant core selected by RPS, the corresponding data packet will be re-affinity to other CPUs, for example, affinity to CPU4 for processing to perform network soft interrupt 18-3.

[0178] It should be noted that the affinity of interrupts refers to binding interrupts to a specified CPU. After the binding is completed, the interrupt will only occur on the bound CPU. Through this function, different interrupts can be dispersed to different CPUs to balance the usage of each CPU and prevent the overhead of a CPU from being particularly high due to excessive concentration of interrupts.

[0179] See also Fig.19 , Fig.19It is a schematic diagram of the interrupt processing flow provided by the embodiment of the present application. PCI device 19-1 (device on the PCI slot) passes the CPU, interrupt vector and interrupt mode of the required interrupt to IO-APIC (Advanced Programmable Interrupt Controller) 19-2 through MSI information. After IO-APIC 19-2 receives the MSI information, it forwards it to the local APIC (i.e., local APIC) 19-4 of the target CPU through bridge 19-3. After the local APIC receives the MSI information, it triggers the interrupt corresponding to vector 19-5 (i.e., vector) to enter the interrupt processing flow. Here, the device external interrupt number virq is a logical number. Each CPU maintains its own interrupt vector table separately, and the mapping from virq to vector is maintained by the system.

[0180] The essence of interrupt affinity is achieved through the Message Address register and Message Data register of the PCI device. Among them, the Message Address register records the ID of the target CPU that needs to be interrupted, and the MessageData register records the interrupt vector number and interrupt triggering method, etc. It is necessary to pay attention to the difference between virq and the interrupt vector number. Secondly, if a virq is bound to multiple CPUs, the system will automatically select an optimal CPU to handle the interrupt according to the IRQ load. When the PCI device sends an interrupt, it essentially passes the values ​​of the Message Address register and the Message Data register to the IO-APIC. The interrupt migration in the embodiment of the present application is essentially to modify the interrupt affinity.

[0181] Below, a comparison is made between the performance and power consumption of a server after applying the method provided in an embodiment of the present application and applying a default performance mode (eg, all CPUs are in performance mode).

[0182] When performing database services on the server, the method provided in the embodiment of the present application and the method in the related art are respectively applied to implement the test. The test content can be a stress test for adding, deleting, modifying and checking a 1G data set, a 10G data set, and a 100G data set, with the concurrency being 128, 256, and 512 respectively.

[0183] For example, Fig. 20 1 is a schematic diagram of the comparison of the query rate per second of a 1G data set under 128 concurrency provided by the embodiment of the present application. Fig. 20For data query 20-1, the query rate per second of the default performance mode is 42363.02, and the query rate per second of the embodiment of the present application is 42168.01; for data modification 20-2, the query rate per second of the default performance mode is 41918.9, and the query rate per second of the embodiment of the present application is 41784.79.

[0184] Fig.21 1 is a comparative diagram of the query rate per second of a 10G data set under a concurrent volume of 128 provided in an embodiment of the present application. Fig.21 For data query 21-1, the query rate per second of the default performance mode is 42573.73, and the query rate per second of the embodiment of the present application is 42267.13; for data modification 21-2, the query rate per second of the default performance mode is 42107.62, and the query rate per second of the embodiment of the present application is 42241.56.

[0185] Fig. 22 1 is a comparative diagram of the query rate per second of a 100G data set provided in an embodiment of the present application under a concurrency of 128. Fig. 22 For data query 22-1, the query rate per second of the default performance mode is 42734.33, and the query rate per second of the embodiment of the present application is 42308.86; for data modification 22-2, the query rate per second of the default performance mode is 42025.52, and the query rate per second of the embodiment of the present application is 41968.7.

[0186] Depend on Figure 20 to Figure 22 It can be seen that, whether in a 1G data set, a 10G data set or a 100G data set, for data query, the query rate per second of the embodiment of the present application and the default performance mode are basically the same, and for data modification, the query rate per second of the embodiment of the present application and the default performance mode are also basically the same, which shows that the embodiment of the present application can guarantee the performance of the server compared to the default performance mode.

[0187] Fig.23 It is a comparative schematic diagram of the power consumption of a 1G data set provided by an embodiment of the present application at a concurrency of 128. For data query 23-1, the power consumption of the default performance mode is 344, and the power consumption of the embodiment of the present application is 314. For data modification 23-2, the power consumption of the default performance mode is 351, and the power consumption of the embodiment of the present application is 319, wherein the unit of power consumption is watt.

[0188] Fig.24This is a comparative diagram of the power consumption of a 10G data set provided by an embodiment of the present application at a concurrency of 128. For data query 24-1, the power consumption of the default performance mode is 346, and the power consumption of the embodiment of the present application is 317. For data modification 24-2, the power consumption of the default performance mode is 352, and the power consumption of the embodiment of the present application is 326 (the unit of power consumption is watt).

[0189] Fig.25 This is a comparative schematic diagram of the power consumption of a 100G data set provided by an embodiment of the present application at a concurrency of 128. For data query 25-1, the power consumption of the default performance mode is 348, and the power consumption of the embodiment of the present application is 320. For data modification 25-2, the power consumption of the default performance mode is 354, and the power consumption of the embodiment of the present application is 328 (the unit of power consumption is watt).

[0190] Depend on Figure 23 to Figure 25 It can be seen that, whether in 1G data set, 10G data set or 100G data set, the power consumption of the embodiment of the present application is reduced compared with the default performance mode. Therefore, the CPU scheduling method provided by the embodiment of the present application can not only ensure the performance of the server, but also save energy for the server.

[0191] It is understandable that in the embodiments of the present application, user information is involved, such as data related to tasks to be processed. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0192] The following is a description of an exemplary structure of the processor scheduling device 255 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 8 As shown, the software modules stored in the processor scheduling device 255 of the memory 250 may include:

[0193] The load statistics module 2551 is used to perform load statistics on N processors to obtain the total load of the N processors; wherein N≥2;

[0194] A bitmap generation module 2552 is used to generate a corresponding processor bitmap for the N processors based on the total load of the N processors, wherein the processor bitmap is used to distinguish between active processors and idle processors among the N processors;

[0195] The processor control module 2553 is used to concentrate the tasks to be processed on the active processors for processing based on the processor bitmap, and adjust the idle processors to the target energy-saving mode to complete the scheduling of the N processors.

[0196] In some embodiments of the present application, the bitmap generation module 2552 is further configured to perform filtering processing on the total load of the N processors to obtain a filtered load; determine a target computing power corresponding to the total load based on the filtered load; determine M active processors and N - M idle processors from the N processors based on the target computing power and the rated computing power of each processor; where 1 ≤ M < N; generate an initial bitmap for the N processors, and use a first marker to mark the processor identifiers of the M active processors in the initial bitmap, and use a second marker to mark the processor identifiers of the N - M idle processors in the initial bitmap to obtain the processor bitmap.

[0197] In some embodiments of the present application, the bitmap generation module 2552 is further configured to obtain historical load, and perform weighted fusion on the historical load and the total load to complete the filtering processing of the total load and obtain the filtered load; where the weighted weight of the historical load is greater than the weighted weight of the total load.

[0198] In some embodiments of the present application, the bitmap generation module 2552 is further configured to determine a corresponding matching computing power and reserved computing power for the filtered load; where the reserved computing power refers to the computing power that a processor needs to have in addition to processing the filtered load; superimpose the matching computing power and the reserved computing power to obtain a superimposed computing power; add a fluctuation computing power corresponding to the load fluctuation to the superimposed computing power, and determine the computing power after adding the fluctuation computing power as the target computing power corresponding to the total load.

[0199] In some embodiments of the present application, the bitmap generation module 2552 is further configured to calculate, according to the target computing power and the rated computing power of each processor, the number of the first processors required to reach the target computing power; calculate, according to the number of tasks corresponding to the total load and the task queuing ability of each processor, the number of the second processors required for the number of tasks; determine the larger number of processors between the number of the first processors and the number of the second processors as the number M of the active processors; determine the M processors with the highest load among the N processors as the active processors, and determine the remaining N - M processors as the idle processors.

[0200] In some embodiments of the present application, the bitmap generation module 2552 is further configured to perform load sampling on each processor to obtain the load information of each processor; accumulate the N load information corresponding to the N processors to complete the load statistics of the N processors and obtain the total load of the N processors.

[0201] In some embodiments of the present application, the active processor runs in the highest performance mode; the processor frequency of the highest performance mode is the highest frequency, and the sleep depth is the lowest depth; the processor frequency of the target energy saving mode is the lowest frequency, and the sleep depth is the highest depth.

[0202] In some embodiments of the present application, the processor scheduling device 255 also includes: an interrupt migration module 2554, which is used to determine the corresponding mapping processor for the idle processor based on the processor bitmap; through the mapping processor, the interrupt on the idle processor is processed, and the idle processor is adjusted to the target energy saving mode.

[0203] In some embodiments of the present application, the interrupt migration module 2554 is also used to eliminate the processor identifier of the idle processor in the processor bitmap to obtain a sparse bitmap; for the processor identifier of the idle processor, the identifier remainder relative to the length of the bitmap array is calculated; the bitmap array is an array obtained by tightly arranging the sparse bitmap; from the bitmap array, the target identifier corresponding to the identifier remainder is screened, and the active processor corresponding to the target identifier is determined as the mapping processor.

[0204] In some embodiments of the present application, the interrupt migration module 2554 is also used to process the network card interrupt on the idle processor through the mapping processor to obtain the data packet of the network card interrupt; distribute the data packet on N processors; when the data packet is distributed to the idle processor, migrate the data packet to the mapping processor, and perform soft interrupt processing on the data packet through the mapping processor.

[0205] In some embodiments of the present application, the processor scheduling device 255 further includes: a frequency setting module 2555, which is used to set the highest frequency of the active processor when turbo frequency is used through a maximum frequency parameter.

[0206] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer readable storage medium. The processor of the computer device reads the computer executable instruction from the computer readable storage medium, and the processor executes the computer executable instruction, so that the computer device executes the processor scheduling method described in the embodiment of the present application.

[0207] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the processor scheduling method provided by the embodiment of the present application, for example, Fig. 9 The processor scheduling method is shown.

[0208] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0209] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0210] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0211] By way of example, computer executable instructions may be deployed to be executed on one computer device or on multiple computer devices located at one site or on multiple computer devices distributed across multiple sites and interconnected by a communication network.

[0212] In summary, through the embodiments of the present application, the computer device implements the division of N processors into active processors and idle processors based on the global load granularity, and by concentrating the tasks to be processed in the active processors for processing, it is possible to quickly respond to the tasks to be processed, thereby ensuring the processing performance of the computer device, and at the same time, directly adjusting the idle processors to the target energy-saving mode, so that the idle processors can always be in a low-power state to achieve energy saving of the computer device; in addition, by directly adjusting the idle processors to the target energy-saving mode, the time required for the trade-off between performance and power consumption is reduced, thereby reducing the time required for the computer device to achieve energy saving; by determining the corresponding mapping processor for the idle processor, and re-affinity the interrupt on the idle processor to the corresponding mapping processor for processing, it can be ensured that the interrupt originally bound to the idle processor is correctly responded to, thereby ensuring the success rate of interrupt execution.

[0213] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A processor scheduling method, characterized in that: The method comprises: Perform load statistics on N processors to obtain the total load of the N processors; wherein N≥2; Based on the total load of the N processors, generating corresponding processor bitmaps for the N processors, wherein the processor bitmap is used to distinguish active processors and idle processors among the N processors; Based on the processor bitmap, the tasks to be processed are concentrated on the active processors for processing, and the idle processors are adjusted to the target energy-saving mode, thereby completing the scheduling of the N processors.

2. The method according to claim 1, characterized in that The generating corresponding processor bitmaps for the N processors based on the total load of the N processors includes: Performing filtering processing on the total load of the N processors to obtain a filtered load; Based on the filtered load, determining a target computing power corresponding to the total load; Based on the target computing power and the rated computing power of each processor, M active processors and NM idle processors are determined from the N processors; wherein 1≤M <N; An initial bitmap is generated for the N processors, and the processor identifiers of the M active processors in the initial bitmap are marked with a first mark, and the processor identifiers of the NM idle processors in the initial bitmap are marked with a second mark to obtain the processor bitmap.

3. The method according to claim 2, characterized in that The filtering process is performed on the total load of the N processors to obtain a filtered load, including: Acquire historical load, and perform weighted fusion on the historical load and the total load to complete filtering processing on the total load to obtain the filtered load; The weight of the historical load is greater than the weight of the total load.

4. The method according to claim 2, characterized in that: The determining, based on the filtered load, a target computing power corresponding to the total load, includes: Determine the corresponding matching computing power and reserved computing power for the filtering load; wherein the reserved computing power refers to the computing power that the processor needs to have in addition to processing the filtering load; Superimposing the matching computing power and the reserved computing power to obtain superimposed computing power; A fluctuating computing power corresponding to the load fluctuation is added to the superimposed computing power, and the computing power after adding the fluctuating computing power is determined as the target computing power corresponding to the total load.

5. The method according to claim 2, characterized in that: The determining, based on the target computing power and the rated computing power of each of the processors, M active processors and NM idle processors from the N processors comprises: Calculating the number of first processors required to achieve the target computing power according to the target computing power and the rated computing power of each of the processors; According to the number of tasks corresponding to the total load and the task queuing capacity of each of the processors, the number of second processors required for the number of tasks is calculated; Determine the largest number of processors between the first number of processors and the second number of processors as the number M of active processors; The M processors with the highest loads among the N processors are determined as the active processors, and the remaining NM processors are determined as the idle processors.

6. The method according to any one of claims 1 to 5, characterized in that: The performing load statistics on the N processors to obtain the total load of the N processors includes: Performing load sampling on each of the processors to obtain load information of each of the processors; The N load information corresponding to the N processors are accumulated to complete the load statistics of the N processors, and the total load of the N processors is obtained.

7. The method according to any one of claims 1 to 5, characterized in that: The active processor runs in a highest performance mode; the processor frequency in the highest performance mode is the highest frequency, and the sleep depth is the lowest depth; The processor frequency of the target energy-saving mode is the lowest frequency, and the sleep depth is the highest depth.

8. The method according to any one of claims 1 to 5, characterized in that: After generating corresponding processor bitmaps for the N processors based on the total load of the N processors, the method further includes: Based on the processor bitmap, determining a corresponding mapping processor for the idle processor; The mapping processor processes the interrupt on the idle processor and adjusts the idle processor to a target energy-saving mode.

9. The method according to claim 8, characterized in that The determining a corresponding mapping processor for the idle processor based on the processor bitmap includes: Eliminate the processor identifiers of the idle processors in the processor bitmap to obtain a sparse bitmap; For the processor identification of the idle processor, the identification remainder relative to the length of the bitmap array is calculated; the bitmap array is an array obtained by closely arranging the sparse bitmap; A target identifier corresponding to the identifier remainder is obtained by screening from the bitmap array, and an active processor corresponding to the target identifier is determined as the mapping processor.

10. The method according to claim 8, characterized in that The processing of the interrupt on the idle processor by the mapping processor includes: Processing the network card interruption on the idle processor through the mapping processor to obtain a data packet of the network card interruption; Distributing the data packets on the N processors; When the data packet is distributed to the idle processor, the data packet is migrated to the mapping processor, and a soft interrupt process is performed on the data packet through the mapping processor.

11. The method according to claim 7, characterized in that After the tasks to be processed are concentrated on the active processors for processing based on the processor bitmap and the idle processors are adjusted to the target energy-saving mode, the method further includes: The maximum frequency parameter is used to set the maximum frequency of the active processor when it is turbo-clocked.

12. A processor scheduling device, characterized in that: The device comprises: A load statistics module, used to perform load statistics on N processors to obtain the total load of the N processors; wherein N≥2; A bitmap generation module, configured to generate a corresponding processor bitmap for the N processors based on the total load of the N processors, wherein the processor bitmap is used to distinguish between active processors and idle processors among the N processors; The processor control module is used to concentrate the tasks to be processed on the active processors for processing based on the processor bitmap, and adjust the idle processors to a target energy-saving mode to complete the scheduling of the N processors.

13. A computer device, characterized in that: The computer device comprises: A memory for storing computer executable instructions; A processor, configured to implement the processor scheduling method according to any one of claims 1 to 11 when executing computer executable instructions stored in the memory.

14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the processor scheduling method according to any one of claims 1 to 11 is implemented.

15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the processor scheduling method according to any one of claims 1 to 11 is implemented.

Citation Information

Cited By

  • Family cloud computing method and system based on set top box

    CN120856592A