Processor scheduling method and apparatus, computer device, computer-readable storage medium, and computer program product
By obtaining the total load of multiple processors, generating processor bitmaps, distinguishing between active and idle processors, and placing tasks and schemas, the problem of energy saving affecting performance in the prior art is solved, and efficient energy management is achieved.
Patent Information
- Application Number
- PCT/CN2024/081305
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-09
- Filing Date
- 2024-03-13
- Publication Date
- 2024-11-14
AI Technical Summary
When prior art saves energy on computer equipment, it usually affects its operating performance and cannot guarantee performance and energy saving at the same time.
By obtaining the total load of multiple processors, a processor bitmap is generated to distinguish between active and idle processors, and the pending tasks are assigned to the active processor processing, and the idle processor is adjusted to the target energy-saving mode.
It realizes that while ensuring the operating performance of computer equipment, it reduces energy consumption and improves energy saving efficiency.
Smart Images

Figure CN2024081305_14112024_PF_FP_ABST
Abstract
Description
Processor scheduling method, device, computer equipment, computer readable storage medium and computer program product
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese patent application with application number 2023105176875 and application date of May 9, 2023, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present application relates to computer energy-saving technology, and in particular to a processor scheduling method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0004] Computer devices consume a certain amount of energy, such as electricity, during operation. To conserve energy, energy-saving technologies can be applied to the central processing unit (CPU), causing the CPU to operate in energy-saving mode, thereby reducing the energy consumption of the computer device. However, related technologies often suffer from the problem that energy-saving technologies can affect the operating performance of the computer system.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a processor scheduling method, apparatus, computer device, computer-readable storage medium, and computer program product, which can both ensure the operating performance of the computer device and save energy on the computer device.
[0007] The technical solution of the embodiment of the present application is implemented as follows:
[0008] An embodiment of the present application provides a processor scheduling method, including:
[0009] Obtain the total load of N processors, where N ≥ 2;
[0010] generating a processor bitmap for the N processors based on the total load, wherein the processor bitmap is used to distinguish active processors and idle processors among the N processors;
[0011] Based on the processor bitmap, the pending tasks are processed on the active processors, and the idle processors are adjusted to a target energy-saving mode.
[0012] An embodiment of the present application provides a processor scheduling device, including:
[0013] A load acquisition module configured to acquire the total load of N processors, where N is greater than or equal to 2;
[0014] a bitmap generating module configured to generate a processor bitmap of the N processors based on the total load, wherein the processor bitmap is used to distinguish active processors and idle processors among the N processors;
[0015] The processor control module is configured to process the pending tasks on the active processors based on the processor bitmap and adjust the idle processors to a target energy-saving mode.
[0016] An embodiment of the present application provides a computer device, including:
[0017] a memory configured to store computer-executable instructions;
[0018] The processor is configured to implement the processor scheduling method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0019] 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.
[0020] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the processor scheduling method provided in the embodiment of the present application is implemented.
[0021] The embodiments of the present application have the following beneficial effects: the computer device generates a processor bitmap for distinguishing active processors and idle processors among the N processors based on the total load of the N processors, and then divides the N processors into active processors and idle processors based on the processor bitmap of the N processors with the global load as the granularity, thereby 1) processing the pending tasks in the active processors to achieve a rapid response to the pending tasks and ensure the processing performance of the computer device; 2) adjusting the idle processors to the target energy-saving mode, so that the idle processors are in a low-power state, thereby achieving energy saving of the computer device. In this way, through the embodiments of the present application, it is possible to both ensure the operating performance of the computer device and save energy on the computer device. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] FIG1 is a schematic diagram of a CPU energy-saving technology;
[0023] FIG2 is a schematic diagram of a CPU energy-saving technology during implementation;
[0024] FIG3 is a schematic diagram showing the relationship between different energy-saving technologies;
[0025] FIG4 is a schematic diagram of the implementation framework of the Cstate technology;
[0026] FIG5 is a schematic diagram of the implementation framework of the Pstate technology;
[0027] FIG6 is a schematic diagram of the framework of the Turbo Boost technology;
[0028] FIG7 is a schematic diagram of the architecture of a processor scheduling system provided in an embodiment of the present application;
[0029] FIG8 is a schematic structural diagram of the server in FIG7 provided in an embodiment of the present application;
[0030] FIG9 is a flowchart of a processor scheduling method according to an embodiment of the present application;
[0031] FIG10 is a second flow chart of a processor scheduling method according to an embodiment of the present application;
[0032] FIG11 is a third flow chart of a processor scheduling method according to an embodiment of the present application;
[0033] FIG12 is a schematic diagram of a CPU scheduling framework of a server provided in an embodiment of the present application;
[0034] FIG13A is a schematic diagram of a calculation process of an active CPU bitmap provided in an embodiment of the present application;
[0035] FIG13B is a schematic diagram of a process for selecting a CPU according to an embodiment of the present application;
[0036] FIG14 is a comparative diagram of task scheduling based on load balancing and task scheduling based on an active CPU bitmap provided in an embodiment of the present application;
[0037] FIG15 is a comparison diagram of limiting the sleep depth of dormant cores provided by an embodiment of the present application;
[0038] FIG16 is a schematic diagram showing changes in the maximum frequency during turbo frequency operation according to an embodiment of the present application;
[0039] FIG17 is a comparative schematic diagram of the interruption limitation provided in an embodiment of the present application;
[0040] FIG18 is a schematic diagram of the process of interrupt migration provided by an embodiment of the present application;
[0041] FIG19 is a schematic diagram of an interrupt processing flow provided by an embodiment of the present application;
[0042] FIG20 is a comparative diagram of the query rate per second of a 1G data set under 128 concurrency provided by an embodiment of the present application;
[0043] FIG21 is a comparative diagram of the query rate per second of a 10G data set provided by an embodiment of the present application at a concurrency of 128;
[0044] FIG22 is a comparative diagram of the query rate per second of a 100G data set provided by an embodiment of the present application at a concurrency of 128;
[0045] FIG23 is a schematic diagram showing a comparison of power consumption of a 1G data set under a concurrency of 128 provided in an embodiment of the present application;
[0046] FIG24 is a schematic diagram showing a comparison of power consumption of a 10G data set under a concurrency of 128 provided in an embodiment of the present application;
[0047] FIG25 is a comparative 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
[0048] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0049] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will 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.
[0050] 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.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0052] 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.
[0053] 1) The Central Processing Unit (CPU) is the core of computing and control of computer equipment and the final execution unit for information processing and program execution.
[0054] 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 within the core are all involved in executing CPU commands, including the arithmetic logic unit (ALU), floating point unit (FPU), level 1 cache (L1 cache), and level 2 cache (L2 cache).
[0055] 3) The processor uncore is the CPU's non-core processor. Uncore functions include the Quick Path Interconnect (QPI) controller, L3 cache, Snoop Agent Pipeline, and storage controller.
[0056] 4) Simulate MultiThreading (SMT) refers to the simultaneous execution of multiple threads on a core, allowing multiple threads to share the resources of the same core.
[0057] 5) A thread is the smallest unit in which an operating system can perform computational scheduling.
[0058] 6) Load refers to the statistical information of threads in the running state and runnable state within a period of time.
[0059] 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.
[0060] 8) Interrupt is a basic concept in computer science. It refers to the process in which, during the normal execution of a program, the computer pauses the execution of the current program due to the occurrence of certain emergency events to handle these emergency events. After the processing is completed, the computer resumes the previously paused program and continues to execute. At the hardware level, interrupts are usually initiated by external devices by sending signals to the CPU to request services. For example, I / O devices need to process CPU data to complete data transmission. At the software level, interrupts can be actively initiated by the operating system or application to implement functions such as task scheduling, error handling, and system calls. The interrupt mechanism allows computers to perform multiple tasks, improving CPU utilization and system response speed. Through interrupts, the CPU does not need to constantly query the status of external devices, but can handle other tasks. When an external device requires CPU processing, it can notify the CPU through an interrupt.
[0061] When a computer device is running, it consumes a certain amount of energy, such as electricity. 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.
[0062] For example, FIG1 is a schematic diagram of the energy-saving technology of the CPU. Referring to FIG1 , 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 each processor core 1-11 provides two threads 1-12. 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 implemented by controlling the non-core frequency 1-6.
[0063] FIG2 is a schematic diagram of the framework of the implementation of the CPU energy-saving technology. Referring to FIG2 , 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 uses different sleep strategies (e.g., step-by-step sleep and specified-level sleep) to meet the needs of different scenarios. The CPU sleep subsystem 2-2 then 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 uses different frequency modulation strategies (e.g., maximum frequency, minimum frequency, on-demand frequency modulation, and degree-scheduled frequency modulation) to meet the needs of different scenarios. The CPU frequency modulation subsystem 2-3 then 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 achieving Turbo Boost.
[0064] There are also certain connections between different energy-saving technologies. Figure 3 illustrates the connections between different energy-saving technologies. Regarding Cstate, the CPU sleep state can be divided into four states: C0, C1, C1E, and C6. In C0, the CPU is active (i.e., executing instructions normally), with the highest required core voltage 3-1, the L1 / L2 cache 3-2 preserved, and an immediate wakeup time 3-3. In C1, the core voltage 3-1 is higher, the L1 / L2 cache 3-2 are preserved, the wakeup time 3-3 is shorter, and the no-load power 3-4 is higher. In C1E, the core voltage 3-1 is lower, the L1 / L2 cache 3-2 are also preserved, the wakeup time 3-3 is longer, and the no-load power 3-4 is reduced. In C6, the core voltage 3-1 is no longer required, the L1 / L2 cache 3-2 are refreshed, the wakeup time 3-3 is longest, and the no-load power 3-4 is further reduced. Therefore, different Cstate states have different relationships with different devices, and the time it takes to return to C0 varies from one Cstate (i.e., energy-saving state) to another. 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, level 1 / level 2 is retained, wake-up time is longer, and no-load power is lower), or PC6 state (core voltage is turned off, level 1 / level 2 is refreshed, wake-up time continues to be normal, and 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 active, 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 level P1 is the highest, which is 2.3GHz, and the frequencies of P1 to Pn gradually decrease. For example, the frequency of level P2 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 Boost acceleration. The CPU turbo frequency in Turbo Boost can be divided into n levels from P01 to P0n, where P01 runs at 2.9GHz, P02 runs at 2.9GHz, P03 runs at 2.8GHz... and P0n runs at 2.4GHz.
[0065] The following is a brief introduction to the implementation framework of different energy-saving technologies.
[0066] Cstate technology is used to control CPU power consumption during idle periods. Due to the long latency of exiting C-states, this can impact system performance. When the CPU is idle, the system schedules the Idle process, which calls the hibernation subsystem's interface to put the CPU to sleep. The hibernation subsystem primarily consists of two components: the policy component and the driver. The policy component uses multiple policies to meet the needs of different scenarios. Table 1 provides a description of different sleep strategies. A common approach involves collecting system load, scheduling, latency, and interrupt information. Based on this information, the system's sleep time is predicted and the system enters a specific sleep depth at the predicted sleep time. The driver component is primarily responsible for driving the hardware. Common drivers include the acpi_idle driver and the intel_idle driver. The acpi_idle driver relies on the ACPI table, which is populated by the BIOS. If the BIOS disables Cstate-related functions, the driver will not function properly. Unlike the acpi_idle driver, the intel_idle driver does not rely on ACPI.
[0067] Table 1
[0068] Figure 4 is a schematic diagram of the Cstate technology implementation framework. The CPU sleep subsystem's core 4-1 first abstracts the sleep subsystem's control module 4-2 and driver module 4-3. The policy component is implemented by the control module 4-2; its primary purpose is to balance performance and power consumption based on the system's state and required data 4-4. The driver component is implemented by the driver module 4-3, which calls architecture-related code 4-5 to drive the hardware 4-6.
[0069] Pstate technology primarily implements frequency regulation through the CPU frequency regulation subsystem. The CPU frequency regulation subsystem can be divided into a policy component and a driver component. The policy component primarily implements various frequency regulation strategies to meet the needs of different scenarios. Table 2 provides a description of the different strategies. A common approach is to collect system load information, scheduling information, latency information, and interrupt information, then predict the system load and adjust the CPU's main frequency based on the load conditions. The driver component implements hardware driving. In actual application scenarios, the two common drivers for the CPU frequency regulation subsystem are the acpi_freq driver and the intel_pstate driver. The intel_pstate driver has a higher priority and is used first; the acpi_freq driver relies on the ACPI table, which is generally populated by the BIOS. If the BIOS disables frequency regulation, the acpi_freq driver will not function properly.
[0070] Table 2
[0071] For example, Figure 5 shows a schematic diagram of the Pstate technology implementation framework. The CPU frequency modulation subsystem's core 5-1 abstracts the frequency modulation subsystem's control module 5-2 and driver module 5-3. The strategy is implemented by control module 5-2; its primary purpose is to adjust the CPU's main frequency based on the system's state and required data 5-4. The driver is implemented by driver module 5-3, which calls architecture-related code 5-5 to drive hardware 5-6.
[0072] 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. 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 frequency within safe temperature and power limits, thereby improving the performance of single-threaded and multi-threaded applications.
[0073] For example, Figure 6 is a schematic diagram of the framework of the turbo acceleration 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 6-2 will start. For example, the operating frequency of the processor core that has reached P1 will continue to increase to P0n or even P01. The maximum turbo frequency depends on the number of active processor cores, or on the number of processor cores at P1 to Pn. Therefore, turbo acceleration can be simply understood as a part of the processor cores giving up power to the turbo processor cores when the total power remains unchanged, so that the turbo processor cores 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 frequency.
[0074] 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 with the load of the CPU as the granularity. 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 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 will take 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 the computer device, the operating performance of the computer device system will be affected, that is, it is impossible to both guarantee the operating performance of the computer device and achieve energy saving on the computer device.
[0075] The embodiments of the present application provide a processor scheduling method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can not only ensure the operating performance of the computer device, but also save energy on 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. The following describes an exemplary application when the computer device is implemented as a server.
[0076] Referring to Figure 7, Figure 7 is a schematic diagram of the architecture of the processor scheduling system provided in an embodiment of the present application. In order to support a processor scheduling application, in the processor scheduling system 100, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) is connected to the server 200 via a network 300. 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 integrated in the server 200. Figure 7 shows a situation where the database 500 is independent of the server 200.
[0077] Server 200 is configured 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; obtain the total load of N processors; based on the total load, generate a processor bitmap of 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, process the tasks to be processed in the active processors, and adjust the idle processors to the target energy-saving mode to complete the scheduling of N processors, and return feedback data of the data pull request to terminal 400-1 and terminal 400-2.
[0078] The terminal 400 - 1 and the terminal 400 - 2 are respectively configured to display the data display interface displayed on the graphical interface 410 - 1 and the graphical interface 410 - 2 , and display the feedback data sent by the server 200 for the user to view.
[0079] 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 realize data calculation, storage, processing, and sharing.
[0080] Cloud computing is a general term for network technologies, information technology, integration technologies, management platforms, and application technologies used in the cloud computing business model. It can form resource pools, provide on-demand resources, and offer flexibility and convenience. Cloud computing technology will become a crucial support. System backend services within technical networks require extensive computing and storage resources, which must be implemented through cloud computing.
[0081] Exemplarily, the 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, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminals 400-1 and 400-2 may be smartphones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, smart home appliances, car terminals, etc., but are not limited thereto. The terminals and servers may be connected directly or indirectly via wired or wireless communications, which is not limited in the embodiments of the present application.
[0082] Referring to Figure 8, Figure 8 is a schematic diagram of the structure of the server (an implementation of a computer device) in Figure 1 provided in an embodiment of the present application. The server 200 shown in Figure 8 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 through a bus system 240. It can be 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, various buses are labeled as bus systems 240 in Figure 8.
[0083] 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.
[0084] 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.
[0085] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 210.
[0086] The memory 250 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. 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.
[0087] In some embodiments, the 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 exemplified below.
[0088] Operating system 251, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0089] A network communication module 252 for reaching other computing devices via one or more (wired or wireless) network interfaces 220 , exemplary network interfaces 220 including Bluetooth, Wireless LAN (WiFi), and Universal Serial Bus (USB);
[0090] a presentation module 253 for enabling presentation of information via one or more output devices 231 (e.g., a display screen, a speaker, etc.) associated with the user interface 230 (e.g., a user interface for operating peripheral devices and displaying content and information);
[0091] The input processing module 254 is configured to detect one or more user inputs or interactions from one of the one or more input devices 232 and to translate the detected inputs or interactions.
[0092] In some embodiments, the processor scheduling device provided in the embodiments of the present application can be implemented in software. FIG8 shows a processor scheduling device 255 stored in the memory 250. The processor scheduling device 255 can be software in the form of a program or plug-in, and includes the following software modules: a load acquisition 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 and can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0093] 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.
[0094] 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), 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 into 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 any form of application, module or plug-in.
[0095] 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 exemplary applications and implementations of computer devices provided by the embodiments of the present application.
[0096] Referring to FIG. 9 , FIG. 9 is a flowchart diagram of a processor scheduling method according to an embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 9 .
[0097] S101: Obtain the total load of N processors.
[0098] 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.
[0099] It can be understood that the load of each processor refers to the statistical information of the threads in the running state and the runnable state of each processor. Therefore, the load of each processor can preliminarily reflect the computing resources required by each processor, that is, the computing power.
[0100] 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.
[0101] In some embodiments of the present application, S101 in FIG. 9 may be implemented by performing the following processing: performing load sampling on each processor to obtain load information of each processor; and accumulating N load information of N processors to obtain the total load of the N processors.
[0102] The computer device can perform load sampling on each processor using an existing load sampling algorithm (e.g., the PELT algorithm, the WALT algorithm, etc.) to obtain load information for each processor. The computer device can also complete load sampling by reading the power consumption of each processor and then determining the load information of each processor based on the corresponding relationship between power consumption and load.
[0103] S102: Generate a processor bitmap for N processors based on the total load.
[0104] Based on the total load obtained by statistics, the computer device divides N processors into idle processors and active processors. That is, the active processor is determined from the N processors, and the processors other than the active processor are determined as idle processors. A bitmap is then generated using the processor identifiers corresponding to the N processors. The processor identifiers of the active processors and the processor identifiers of the idle processors are marked in different marking methods in the bitmap, and the marked bitmap is determined as the processor bitmap. For example, the processor identifier of the active processor can be marked as 1, and the processor identifier of the idle processor can be marked as 0. Therefore, the obtained processor bitmap can be used to distinguish between active processors and idle processors among the N processors.
[0105] It should be noted that active processors refer to processors that need to remain active in the future (i.e., for a period of time in the future), and can quickly respond to subsequent pending tasks and process them. Therefore, all subsequent pending tasks can be concentrated on the active processors for processing, and the corresponding operating frequency can be set for the active processors to ensure the computer device's task processing performance. Idle processors, on the other hand, are processors that need to remain idle in the future (i.e., for a period of time in the future), that is, they will not participate in the processing of any pending tasks. Therefore, these idle processors can be directly adjusted to the required energy-saving mode, such as controlling the idle processors to enter deep sleep, or controlling the idle processors to run at the lowest frequency, etc., to save energy consumption of the computer device.
[0106] 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 N processors into M active processors and NM idle processors, then as the total load increases, M will gradually increase (1≤M≤N), and NM will gradually decrease. In this way, based on the total load of the N processors, a processor bitmap can be generated to distinguish between active processors and idle processors in the N processors, thereby realizing the division of N processors into active processors and idle processors based on the global load, so as to facilitate the subsequent rapid scheduling of N processors while ensuring the processing performance and energy saving of the processors.
[0107] Computer devices can generate processor bitmaps in a variety of different ways. The following describes the generation process of the processor bitmap.
[0108] See Figure 10, which is a second flow chart of the processor scheduling method provided by an embodiment of the present application. In some embodiments of the present application, S102 in Figure 9 can be implemented through S1021-S1024 as follows:
[0109] S1021. Filter the total load to obtain a filtered load.
[0110] Because the load of each processor does not change smoothly, for example, at a certain moment the load may suddenly increase and then suddenly decrease, resulting in large fluctuations in the load of each processor. Although superimposing the loads of N processors can eliminate fluctuations to a certain extent (i.e., peaks and troughs cancel each other out), it cannot completely eliminate fluctuations, resulting in an uneven total load. This uneven total load requires frequent generation of processor bitmaps (in fact, sudden changes in the total load are very short-lived and do not require additional division into active and idle processors). Therefore, in order to minimize the number of unnecessary processor bitmap generations, the computer device will filter the total load to make it smoother, thereby obtaining a filtered load.
[0111] In some embodiments of the present application, a computer device can filter the total load based on historical load. More specifically, S1021 in FIG. 10 can be implemented by the following process: obtaining the historical load and weightedly fusing the historical load and 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. Specifically, filtered load = historical load * weighted weight of historical load + total load * weighted weight of total load.
[0112] That is, in the embodiment of the present application, the computer device calculates a smoother load using historical loads at historical times and the total load obtained from current statistics to obtain a filtered load. Because the difference between the historical load and the actual load at the current time is not very large, a larger weight can be assigned to the historical load and a smaller weight can be assigned to the total load. This allows the smoothed load to be more considered in the calculation of the historical load, thereby ensuring the accuracy of the filtered load.
[0113] 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 through a limiting filtering algorithm, etc., which is not limited in the embodiments of the present application.
[0114] In this way, S1021 can make the total load of N processors smoother, reduce the impact of processor load fluctuations, thereby reducing the number of processor bitmap generation times and improving the generation accuracy of the processor bitmap, and reducing the consumption of device resources required by the computer device to generate the processor bitmap.
[0115] S1022. Determine the target computing power corresponding to the total load based on the filtered load.
[0116] After obtaining a smoother filtered load, the computer device will determine the total computing power required to process the total load based on the filtered load, and determine this total computing power as the target computing power corresponding to the total load. It should be noted that when determining the target computing power, the computer device can determine the target computing power based solely on the filtered load, or it can consider other factors, such as computing power fluctuations, based on the filtered load to determine the final target computing power.
[0117] In some embodiments of the present application, S1022 in FIG. 10 may be implemented by the following processing: determining the matching computing power corresponding to the filtering load, and determining the matching computing power as the target computing power corresponding to the total load.
[0118] 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 a target multiple of the number of threads (such as 1.5 times)), as the target computing power for the total load. In this way, the target computing power can exactly meet the processing of the total load, thus preventing computing power from being wasted and improving the utilization of computing resources.
[0119] In other embodiments of the present application, S1022 in Figure 10 can also be implemented through the following processing: determining the matching computing power and reserved computing power corresponding to the filtering load; superimposing the matching computing power and the reserved computing power to obtain a first superimposed computing power; adding the fluctuating computing power corresponding to the load fluctuation to the first superimposed computing power to obtain a second superimposed computing power, and determining the second superimposed computing power as the target computing power corresponding to the total load.
[0120] Among them, the reserved computing power refers to the computing power that the processor needs to have in addition to the computing power required to process the filtering load. The reserved computing power can be calculated by the matching computing power of the filtering load and the utilization rate of the processor. For example, when the matching computing power of the filtering load is Cma and the processor utilization rate is 50%, then 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 the sudden situation of a single processor, such as processor congestion, to ensure the normal operation of the processor.
[0121] In addition, the computer device also needs to consider load fluctuations, that is, by adding fluctuating computing power to the first superimposed computing power to cope with load fluctuations. The fluctuating computing power can be a preset value or the average of the total load and the filtered load, which is not limited in this embodiment of the application.
[0122] 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, so as to ensure that a sufficient number of active processors can be obtained, thereby ensuring the operating performance of the computer equipment.
[0123] 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.
[0124] 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. Then, based on the target computing power and the read rated computing power, it will determine how many processors are needed to achieve the target 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, thus completing the division of N processors into active processors and idle processors. Among them, 1≤M <N。
[0125] In some embodiments of the present application, S1023 in Figure 10, that is, 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: determining a first number of processors required to achieve the target computing power according to the target computing power and the rated computing power of each processor; determining a second number of processors required to complete the number of tasks according to the number of tasks corresponding to the total load and the task queuing capacity of each processor; determining the largest number of processors between the first number of processors and the second number of processors as the number M of active processors; determining the M processors with the highest load among the N processors as active processors, and determining NM processors among the N processors that are different from the active processors as idle processors.
[0126] That is, the computer device first determines how many processors are needed to achieve the target computing power by reading the rated computing power of each processor. For example, 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. If the rated computing power of each processor is different, the rated computing power can be sorted from largest to smallest to obtain a rated computing power sequence. The rated computing powers are then added starting from the head of the rated computing power sequence until the added result reaches or exceeds the target computing power. The number of all processors involved in the addition is then used as the first number of processors.
[0127] 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 of a processor is larger, it will take longer for the last task in the queue to be processed, 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 to determine the number of processors required to complete the number of tasks, thereby obtaining the second number of processors.
[0128] Next, the computer device will select the largest number of processors from the first number of processors and the second number of processors as the number M of active processors. In this way, the number of active processors can be more sufficient, ensuring the processing performance of the computer device when saving energy. Finally, the computer device will select the M processors with the highest load from the N processors (the reason for selecting the M processors with the highest load is that processors with high loads take longer to enter energy-saving mode than processors with low loads) as active processors, and use the remaining NM processors as idle processors to complete the division of active processors and idle processors. In this way, the selected idle processors can be controlled to enter energy-saving mode at a faster speed, thereby improving the scheduling efficiency of the processor and the energy-saving effect of the computer device.
[0129] Of course, in other embodiments of the present application, S1023 in Figure 10, that is, 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 also be implemented by the following processing: determining a first number of processors required to achieve the target computing power according to the target computing power and the rated computing power of each processor; determining the first number of processors as the number M of active processors; randomly selecting M processors from the N processors and determining them as active processors, and determining NM processors other than the active processors in the N processors as idle processors.
[0130] 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, improving the speed of dividing active processors and idle processors, and thereby improving the scheduling efficiency of the processors and the energy-saving effect of the computer device.
[0131] S1024: Generate an initial bitmap of N processors, and mark the processor identifiers of M active processors in the initial bitmap with a first mark, and mark the processor identifiers of NM idle processors in the initial bitmap with a second mark to obtain a processor bitmap.
[0132] Here, the second mark is different from the first mark. The computer device first generates an initial bitmap using the processor identifiers of each of the N processors (e.g., the processor name, the processor ID), so that the resulting initial bitmap can be viewed as an array or queue consisting of the processor identifiers of each of the N processors. Next, the computer device determines the processor identifier of each active processor from the initial bitmap and marks the processor identifier of each active processor using the first mark. It then determines the processor identifier of each idle processor from the initial bitmap and marks the processor identifier of each idle processor using the second mark. After completing the marking of each processor identifier in the initial bitmap, the computer device obtains a processor bitmap.
[0133] It should be noted that, in the embodiment of the present application, the first flag and the second flag can be two different numerical values, for example, the first flag is 1 and the second flag is 0. The first flag and the second flag can also be two different logical values, for example, the first flag is true and the second flag is false.
[0134] In some embodiments, the first tag and the second tag can be written directly on the initial bitmap, so that each bit in the resulting processor bitmap contains two elements, namely, the processor identifier and its corresponding tag. In other embodiments, the first tag and the second tag can be recorded using a mask bitmap of the same size as the initial bitmap, i.e., each bit in the initial bitmap is the processor identifier, and each bit in the mask bitmap is the tag corresponding to the processor identifier. In this way, the processor bitmap can be composed of two bitmaps: the initial bitmap and the mask bitmap.
[0135] 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 while 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 processes.
[0136] In other embodiments of the present application, S102 in FIG. 9 can also be implemented by the following process: performing a difference calculation between the total load of the N processors and multiple historical total loads corresponding to multiple historical bitmaps to obtain a total load difference, and determining the historical bitmap corresponding to the historical total load for which the total load difference is less than a difference threshold as the processor bitmap for the N processors. In this way, by determining the total load difference between the current total load and the historical total load, and selecting from the historical bitmaps of the historical total load that corresponds to the total load difference less than the difference threshold as the processor bitmap for the N processors, the processor bitmap generation logic can be simplified and the processor bitmap generation efficiency can be improved.
[0137] S103 : Based on the processor bitmap, process the pending tasks on the active processors and adjust the idle processors to the target energy-saving mode.
[0138] After obtaining the processor bitmap, the computer device will select the active processor through the marks corresponding to different processor identifiers in the processor bitmap, and assign the pending tasks to the active processor for processing, thereby ensuring the operating performance of the computer device; while the idle processor does not need to process the pending tasks and will remain idle. The computer device will adjust the idle processor to the target energy-saving mode to reduce energy consumption and achieve energy saving of the computer device.
[0139] 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.
[0140] In some embodiments, the active processor runs in the highest performance mode, where the processor frequency is the highest and the sleep depth is the lowest; the target energy saving mode, where the processor frequency is the lowest and the sleep depth is the highest. This ensures that the processing performance of the computer device is maximized while minimizing the energy consumption of the computer device.
[0141] 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. Here, the specified frequency can be set according to the number of tasks to be processed, and the specified frequency can be less than the maximum frequency. The specified depth can also be set according to energy-saving requirements, and the specified depth can be less than the maximum depth. In this way, 1) by controlling the performance mode of the active processor according to the situation of the tasks to be processed, it is possible to ensure the processing performance of the computer device for the tasks to be processed, and it is also possible to appropriately reduce the consumption of device resources to achieve energy-saving effects; 2) by controlling the sleep depth of the idle processor according to energy-saving requirements, it is possible to ensure that the computer device achieves energy-saving effects, and it is also possible to reduce the time required for the idle processor to exit the energy-saving mode.
[0142] It is understandable that, compared to 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 between active processors and idle processors in the N processors based on the total load of the N processors, thereby achieving the global load as the granularity, based on the processor bitmap of the N processors, dividing the N processors into active processors and idle processors, thereby 1) processing the pending tasks in the active processors, achieving a rapid response to the pending tasks, and ensuring the processing performance of the computer device; 2) adjusting the idle processors to the target energy-saving mode, so that the idle processors are in a low-power state, achieving energy saving of the computer device. In this way, a state that can both ensure the operating performance of the computer device and save energy on the computer device is achieved. In addition, in the embodiment of the present application, the computer device reduces the time required to balance between performance and power consumption by directly adjusting the idle processors to the target energy-saving mode, thereby reducing the time required for the computer device to achieve energy saving and improving the efficiency of energy saving.
[0143] Based on Figure 9, refer to Figure 11, which is a flowchart diagram of the processor scheduling method provided by an embodiment of the present application. In some embodiments of the present application, after S102 in Figure 9, the method may further include the following processing: S104-S105, as follows:
[0144] S104 : Determine a mapping processor of the idle processor from the active processors based on the processor bitmap.
[0145] Because idle processors need to be adjusted to the target energy-saving mode to save energy later, they will not respond to interrupts, similar to pending tasks. Therefore, after determining the idle processors, the computer device needs to use the processor bitmap to determine a mapping processor for each idle processor from the active processors that can handle its interrupts.
[0146] In some embodiments of the present application, S104 in Figure 11 can be implemented by the following processing: removing the processor identifiers of idle processors in the processor bitmap to obtain a sparse bitmap; determining the remainder obtained by dividing the processor identifier of the idle processor by the length of the bitmap array; determining the target identifier corresponding to the remainder from the bitmap array, and determining the active processor corresponding to the target identifier as the mapping processor.
[0147] For each idle processor, 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 called a sparse bitmap. Then, the computer device rearranges the sparse bitmap into a compact array, which is called a bitmap array. That is, the bitmap array is an array obtained by compactly arranging the sparse bitmap, and determines the remainder obtained by dividing the processor identifier of the idle processor by the length of the bitmap array. This remainder is also called an identifier remainder. Finally, according to the identifier remainder, the processor identifier corresponding to the identifier remainder is determined from the bitmap array as the target identifier, that is, the processor identifier with the same index as the original position of the processor identifier of the idle processor, thereby selecting the active processor corresponding to the target identifier as the mapping processor. In this way, the corresponding active processor can be selected as the mapping processor for each idle processor, thereby achieving a reasonable allocation of interrupts on the idle processor and ensuring the operating performance of the processor.
[0148] 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 bitmap array corresponding to the sparse bitmap is [0, 1, 2, 4, 5, 6, 7, 8, 9], and the length of the bitmap array of the sparse bitmap is 9. The computer device determines the remainder of 3 divided by 9, which is 3, so the identifier remainder is 3. Finally, the computer device uses the obtained identifier remainder to 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.
[0149] In some embodiments of the present application, S104 in Figure 11 can also be implemented by the following processing: removing the processor identifiers of 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.
[0150] 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, thereby simplifying the mapping processor determination logic and improving the mapping processor determination efficiency.
[0151] S105: Process the interrupt on the idle processor by mapping the processor.
[0152] Then, when the interrupt originally bound to the idle processor is triggered, the computer device will migrate the interrupt to the mapped processor for processing, so that all interrupts are limited to be processed on the active processor, and the idle processor is in the target energy-saving mode, which can achieve energy saving of the computer device.
[0153] In some embodiments of the present application, S105 in Figure 11 can be implemented through the following processing: through the mapping processor, the network card interrupt on the idle processor is processed to obtain the network card interrupt data packet; the data packet is distributed to N processors; when the data packet is distributed to the idle processor, the data packet is migrated to the mapping processor, and the mapping processor is used to perform soft interrupt processing on the data packet.
[0154] In an embodiment of the present application, the computer device will re-affinity the network card interrupt originally bound to the idle processor to the mapping processor of the idle processor for processing to generate the corresponding data packet, and then continue to distribute the data packet to different processors for processing 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 processor respectively to complete the corresponding processing.
[0155] In other embodiments of the present application, S105 in Figure 11 can also be implemented through the following processing: by mapping the processor, only the network card interrupt on the idle processor is processed to obtain the network card interrupt data packet; the data packet is distributed to any active processor for soft interrupt processing.
[0156] 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.
[0157] In some embodiments of the present application, after processing the pending tasks on the active processor based on the processor bitmap and adjusting the idle processor to the target energy-saving mode, the method may also include the following processing: setting the maximum frequency of the active processor when turbo-clocked through the maximum frequency parameter.
[0158] This is because, when a 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, the turbo-clocked condition is met, and thus, at most only the number of active processors, that is, M processors, participate in turbo-clocking, which will increase the maximum turbo-clocked frequency. However, the increase in the maximum turbo-clocked 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, thereby facilitating power consumption control for the active processor and helping to save energy on the computer device.
[0159] 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 embodiment of the present application is not limited here.
[0160] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.
[0161] 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 both the operating performance of the server and energy saving of the server.
[0162] Figure 12 is a schematic diagram of the CPU scheduling framework of the server provided in an embodiment of the present application. Referring to Figure 12, the scheduling framework includes a scheduling module 12-1, an elastic policy module 12-2, an active CPU bitmap 12-3 (called a processor bitmap), a CPU frequency modulation subsystem 12-4, a CPU sleep subsystem 12-5, an interrupt migration module 12-6, and a turbo frequency maximum frequency control module 12-7. Among them, the scheduling module 12-1 calls the elastic policy module 12-2 to generate an active CPU bitmap 12-3 based on the load of all CPUs, and then schedules 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 based on the active CPU bitmap 12-3. In more detail, the active CPU bitmap 12-3 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 migrates the interrupts on the idle CPU according to the active CPU bitmap 12-3, and calls 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, thereby realizing the control of the maximum frequency during turbo.
[0163] 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. Figure 13A is a schematic diagram of the calculation process of the active CPU bitmap provided by the embodiment of the present application. Referring to Figure 13, the elastic policy module first performs a computing power sampling 13-1 on the CPU to obtain the computing 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 maIt 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 ma The arithmetic mean of |δC| is called the fluctuating computing power; then, the target number of cores N1 is determined according to the target computing power = roundup{C t / C} (N1 is called the first number of processors, 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, activating more cores when the target computing power is high, and dormant more cores when the target computing power is low; finally, the maximum queuing capacity of each core (called task queuing capacity) needs to be considered, and the target number of cores N2 is defined as roundup{T 总 / 2}(N2 is called the number of second processors, T 总 Identify the total number of queued processes, also known as the number of tasks, where 2 is the task queuing capacity. The final total number of active cores (called the number of active processors, M) is taken as max{N1, N2}. Finally, based on the calculated total number of active cores, select the CPU with the highest load in the system to generate the active CPU bitmap 13-5.
[0164] Figure 13B is a schematic diagram of the process of selecting a CPU provided by an embodiment of the present application. There are 10 CPUs in the server 13-6, and the load of each CPU is 10%. Based on the load 13-7 of all CPUs and the utilization 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.
[0165] Through the active CPU bitmap, tasks can only be scheduled to active CPUs.
[0166] For example, FIG14 is a comparative diagram of task scheduling based on load balancing and task scheduling based on active CPU bitmap provided in an 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 an 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.
[0167] The CPU sleep subsystem is used to limit the maximum sleep depth of active cores (called active processors) to C1 to ensure performance and limit dormant cores to the deepest sleep depth. Figure 15 is a comparison diagram of limiting the sleep depth of dormant cores provided in an embodiment of the present application. Referring to Figure 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, becoming 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 solution 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.
[0168] The CPU frequency scaling subsystem is used to adjust the CPU frequency of active cores to the highest frequency and the CPU frequency of dormant cores to the lowest frequency. Its implementation process is similar to that in Figure 15.
[0169] The turbo frequency maximum frequency control module controls the maximum frequency of the CPU when it is in turbo frequency through parameters (called maximum frequency parameters). For example, Figure 16 is a schematic diagram of the change of the maximum frequency during turbo frequency provided in an embodiment of the present application. Referring to Figure 16, as the number of turbo frequency cores increases, the maximum frequency of turbo frequency will gradually decrease, that is, from frequency level 1 to frequency level 3. For example, when the number of turbo frequency cores increases to 24, the maximum frequency will be reduced to frequency level 3, that is, 2.4GHz. Conversely, when the number of turbo frequency cores decreases, the maximum frequency of turbo frequency increases. In order to save energy, it is necessary to control the maximum frequency of turbo frequency.
[0170] The interrupt migration module limits the CPU interrupt to the active core through the active CPU bitmap. For example, Figure 17 is a comparative diagram of the interrupt limitation provided in the embodiment of the present application. When the interrupt limitation is performed based on the relevant technology, for the interrupt in queue 17-1, both the active core 17-2 (i.e., CPU0 and CPU1) and the dormant core 17-3 (CPU2) need to respond for processing; and in the technology of the embodiment of the present application, for the interrupt in queue 17-1, if it is bound to the dormant core, it needs to be migrated to the active core for processing. In this way, the dormant core can remain in a dormant state.
[0171] FIG18 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 obtains a discontinuous active CPU bitmap (referred to as a sparse bitmap) 18-1 and rearranges the bitmap to generate an array cpu_map (referred to as a bitmap array), whose specific content is {0, 1, 2, 4, 5, 6, 7, 8, 9}. The server system then uses the originally designated CPU (referred to as the processor identifier of the idle processor) to perform a remainder index on cpu_map, i.e., performing the process new_cpu = cpu_map[old_cpu%9], to obtain the remapped CPU (referred to as the mapped processor). For example, the original interrupt affinity of CPU3 is re-affinityed to CPU4 according to the algorithm cpu_map[3] = 4. Referring to FIG18 , for the network card interrupt 18 - 2 , the server system will affinity it to CPU4 , and for the dormant core selected by the RPS , the corresponding data packet will also be reaffinityed to other CPUs , for example , affinity to CPU4 for processing to perform the network soft interrupt 18 - 3 .
[0172] It should be noted that interrupt affinity refers to binding an interrupt to a specific CPU. Once bound, the interrupt will only occur on the bound CPU. This feature allows you to distribute different interrupts to different CPUs to balance the utilization of each CPU and prevent excessive interrupt concentration from causing high overhead on a single CPU.
[0173] Refer to Figure 19, which is a schematic diagram of the interrupt processing flow provided by an 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 of virq to vector is maintained by the system.
[0174] 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 Message Data register records the interrupt vector number and interrupt triggering method, etc. It is important to note 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 based on 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.
[0175] Below, a comparison is made between the performance and power consumption of the server after applying the method provided in the embodiment of the present application and applying the default performance mode (for example, all CPUs are in the performance mode).
[0176] When performing database services on a server, the methods provided in the embodiments of this application and the methods in related technologies are applied to implement the test. The test content can be a stress test for adding, deleting, modifying, and checking 1G data sets, 10G data sets, and 100G data sets, with concurrency levels of 128, 256, and 512, respectively.
[0177] For example, Figure 20 is a comparative diagram of the query rates per second for a 1GB dataset under 128 concurrent connections, provided by an embodiment of the present application. Referring to Figure 20 , for data query 20-1, the query rate per second in the default performance mode is 42363.02, while the query rate per second in the embodiment of the present application is 42168.01. For data modification 20-2, the query rate per second in the default performance mode is 41918.9, while the query rate per second in the embodiment of the present application is 41784.79.
[0178] Figure 21 is a comparative diagram of the query rates per second for a 10GB dataset under a concurrency of 128, provided by an embodiment of the present application. Referring to Figure 21 , for data query 21-1, the query rate per second in the default performance mode is 42573.73, while the query rate per second in the embodiment of the present application is 42267.13. For data modification 21-2, the query rate per second in the default performance mode is 42107.62, while the query rate per second in the embodiment of the present application is 42241.56.
[0179] Figure 22 is a comparative diagram of the query rates per second for a 100GB dataset under a concurrency of 128, provided by an embodiment of the present application. Referring to Figure 22 , for data query 22-1, the query rate per second in the default performance mode is 42734.33, while the query rate per second in the embodiment of the present application is 42308.86. For data modification 22-2, the query rate per second in the default performance mode is 42025.52, while the query rate per second in the embodiment of the present application is 41968.7.
[0180] As can be seen from Figures 20 to 22, whether it is 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.
[0181] Figure 23 is a schematic diagram comparing the power consumption of a 1GB dataset at a concurrency of 128 according to an embodiment of the present application. For data query 23-1, the power consumption in the default performance mode is 344, while that in the embodiment of the present application is 314. For data modification 23-2, the power consumption in the default performance mode is 351, while that in the embodiment of the present application is 319. All power consumption is expressed in watts.
[0182] Figure 24 is a schematic diagram comparing power consumption for a 10G dataset at a concurrency of 128, provided by an embodiment of the present application. For data query 24-1, the power consumption in the default performance mode is 346, while that in the embodiment of the present application is 317. For data modification 24-2, the power consumption in the default performance mode is 352, while that in the embodiment of the present application is 326 (all power consumption units are watts).
[0183] Figure 25 is a schematic comparison diagram of the power consumption of the 100G data set provided by the embodiment of the present application under a concurrency of 128. For data query 25-1, the power consumption in 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 in 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 watts).
[0184] As can be seen from FIGS. 23 to 25, whether it is a 1G data set, a 10G data set or a 100G data set, the power consumption of the embodiment of the present application is lower than that of the default performance mode. Thus, 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.
[0185] It can be understood that in the embodiment of the present application, user information is involved, such as data related to tasks to be processed. When the embodiment of the present application is applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0186] Next, the exemplary structure of the software module implementation of the processor scheduling device 255 provided by the embodiment of the present application will be continued. In some embodiments, as shown in FIG. 8, the software module in the processor scheduling device 255 stored in the memory 250 may include: a load acquisition module 2551 configured to acquire the total load of the N processors, where N≥2; a bitmap generation module 2552 configured to generate a processor bitmap of the N processors based on the total load, where the processor bitmap is used to distinguish active processors and idle processors among the N processors; a processor control module 2553 configured 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.
[0187] In some embodiments of the present application, the bitmap generation module 2552 is further configured to perform filtering processing on the total load to obtain a filtered load; determine the 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 of 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.
[0188] In some embodiments of the present application, the bitmap generation module 2552 is further configured to obtain historical load, and perform weighted fusion of the historical load and the total load to obtain the filtered load; wherein the weighted weight of the historical load is greater than the weighted weight of the total load.
[0189] In some embodiments of the present application, the bitmap generation module 2552 is further configured to determine the matching computing power and reserved computing power corresponding to the filtering load; wherein the reserved computing power is the computing power that the processor needs to have in addition to the computing power to process the filtering load; the matching computing power and the reserved computing power are superimposed to obtain a first superimposed computing power; the fluctuating computing power corresponding to the load fluctuation is added to the first superimposed computing power to obtain a second superimposed computing power, and the second superimposed computing power is determined as the target computing power corresponding to the total load.
[0190] In some embodiments of the present application, the bitmap generation module 2552 is further configured to determine a first number of processors required to achieve the target computing power according to the target computing power and the rated computing power of each of the processors; determine a second number of processors required to complete the number of tasks according to the number of tasks corresponding to the total load and the task queuing capacity of each of the processors; 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; determine the M processors with the highest load among the N processors as the active processors, and determine NM processors among the N processors that are different from the active processors as the idle processors.
[0191] In some embodiments of the present application, the bitmap generation module 2552 is further configured to perform load sampling on each of the processors to obtain load information of each of the processors; and to accumulate the N load information corresponding to the N processors to obtain the total load of the N processors.
[0192] In some embodiments of the present application, the active processor runs in one of the highest performance mode and the specified performance mode; wherein 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 specified performance mode is the specified frequency, and the sleep depth is the lowest depth; wherein the processor frequency of the target energy saving mode is the lowest frequency, and the sleep depth is one of the highest depth and the specified depth.
[0193] In some embodiments of the present application, the processor scheduling device 255 also includes: an interrupt migration module 2554, configured to determine the mapping processor of the idle processor from the active processors based on the processor bitmap; and process the interrupt on the idle processor through the mapping processor.
[0194] In some embodiments of the present application, the interrupt migration module 2554 is further configured to remove the processor identifier of the idle processor in the processor bitmap to obtain a sparse bitmap; determine the remainder obtained by dividing the processor identifier of the idle processor by the length of the bitmap array; wherein the bitmap array is an array obtained by tightly arranging the sparse bitmap; from the bitmap array, determine the target identifier corresponding to the remainder, and determine the active processor corresponding to the target identifier as the mapping processor.
[0195] In some embodiments of the present application, the interrupt migration module 2554 is further configured 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 to N of the 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.
[0196] In some embodiments of the present application, the processor scheduling device 255 further includes: a frequency setting module 2555 configured to set the highest frequency of the active processor when turbo-clocked by using a maximum frequency parameter.
[0197] In some embodiments of the present application, the bitmap generation module 2552 is further configured to determine the total load of the N processors and the total load difference between the total loads corresponding to each historical bitmap in a plurality of historical bitmaps; and determine the historical bitmap corresponding to the total load whose total load difference is less than a difference threshold as the processor bitmap of the N processors.
[0198] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the computer device to perform the processor scheduling method described above in the embodiment of the present application.
[0199] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the processor scheduling method provided by an embodiment of the present application, for example, the processor scheduling method shown in Figure 9.
[0200] 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 various devices including one or any combination of the above memories.
[0201] 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.
[0202] 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 that stores 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 coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0203] By way of example, computer-executable instructions may be deployed to be executed on one computer device or on multiple computer devices at one site or on multiple computer devices distributed across multiple sites and interconnected by a communication network.
[0204] To summarize, through the embodiments of the present application, the computer device will generate a processor bitmap for distinguishing active processors and idle processors among the N processors based on the total load of the N processors, and then divide the N processors into active processors and idle processors based on the processor bitmap of the N processors with the global load as the granularity, so that 1) the tasks to be processed are processed in the active processor to achieve a rapid response to the tasks to be processed and ensure the processing performance of the computer device; 2) the idle processor is adjusted to the target energy-saving mode so that the idle processor is in a low-power state to achieve energy saving of the computer device; 3) by directly adjusting the idle processor 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; 4) 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.
[0205] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A processor scheduling method, applied to a computer device, the method comprising: Obtain the total load of N processors, where N ≥ 2; Based on the total load, generating a processor bitmap of 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 pending tasks are processed on the active processors, and the idle processors are adjusted to a target energy-saving mode.
2. The method according to claim 1, wherein: The generating, based on the total load, a processor bitmap of the N processors comprises: Performing filtering on the total load 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 of the N processors is generated, and processor identifiers of the M active processors in the initial bitmap are marked with a first mark, and 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, wherein: The filtering the total load to obtain a filtered load includes: Acquire historical load, and perform weighted fusion of the historical load and 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, wherein: The determining, based on the filtered load, a target computing power corresponding to the total load, includes: Determine the matching computing power and reserved computing power corresponding to the filtering load; wherein the reserved computing power is the computing power that the processor needs to have in addition to the computing power for processing the filtering load; Superimposing the matching computing power and the reserved computing power to obtain a first superimposed computing power; A fluctuating computing power corresponding to the load fluctuation is added to the first superimposed computing power to obtain a second superimposed computing power, and the second superimposed computing power is determined as the target computing power corresponding to the total load.
5. The method according to claim 2, wherein: 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: Determining a first number of processors required to achieve the target computing power according to the target computing power and the rated computing power of each of the processors; Determine the number of second processors required to complete the number of tasks according to the number of tasks corresponding to the total load and the task queuing capacity of each processor; 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 load among the N processors are determined as the active processors, and NM processors other than the active processors among the N processors are determined as the idle processors.
6. The method according to any one of claims 1 to 5, wherein: The obtaining 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 obtain the total load of the N processors.
7. The method according to any one of claims 1 to 6, wherein: The active processor operates in one of a maximum performance mode and a specified 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 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 one of the highest depth and the specified depth.
8. The method according to any one of claims 1 to 7, wherein: After generating the processor bitmaps of the N processors based on the total load, the method further includes: Based on the processor bitmap, determining a mapping processor of the idle processor from the active processors; The interrupt on the idle processor is processed by the mapping processor.
9. The method according to claim 8, wherein: The step of determining a mapping processor of the idle processor from the active processors based on the processor bitmap comprises: Eliminate the processor identifiers of the idle processors in the processor bitmap to obtain a sparse bitmap; Determine the remainder obtained by dividing the processor identifier of the idle processor by the length of the bitmap array; wherein the bitmap array is an array obtained by closely arranging the sparse bitmap; A target identifier corresponding to the remainder is determined 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, wherein: Processing 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 packet to 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, wherein: After processing the pending tasks on the active processor based on the processor bitmap and adjusting the idle processor 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. The method according to any one of claims 1 to 11, wherein: The generating, based on the total load, a processor bitmap of the N processors comprises: Determine a total load difference between the total load of the N processors and a total historical load corresponding to each historical bitmap in a plurality of historical bitmaps; The historical bitmap corresponding to the historical load total amount whose load total amount difference is less than the difference threshold is determined as the processor bitmap of the N processors.
13. A processor scheduling device, the device comprising: A load acquisition module, configured to acquire the total load of N processors, where N≥2; A bitmap generation module is configured to generate a processor bitmap of the N processors based on the total load, wherein the processor bitmap is used to distinguish between active processors and idle processors among the N processors; The processor control module is configured to process the pending tasks on the active processor based on the processor bitmap and adjust the idle processor to a target energy-saving mode.
14. A computer device, comprising: a memory configured to store computer executable instructions; The processor is configured to implement the processor scheduling method according to any one of claims 1 to 12 when executing the computer executable instructions stored in the memory.
15. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the processor scheduling method according to any one of claims 1 to 12.
16. A computer program product, comprising a computer program or a computer executable instruction, wherein the computer program or the computer executable instruction, when executed by a processor, implements the processor scheduling method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Method and apparatus for performing energy-efficient network packet processing in multi processor core system
CN102460342A
Interrupt distribution scheme
CN102567109A
Service scheduling method and device
CN109039929A
Load balancing scheduling method and computing device
CN115391031A
Method, system, and apparatus for rerouting interrupts in a multi-core processor
US20090172423A1
Cited By
Intelligent scheduling management system for computing power resources
CN120371520A
Multi-chip interrupt scheduling method based on RISC-V architecture
CN122653689A
Circuitry and methods for mitigating processing events
WO2026202493A1
