CN110968403A - CPU work control method, device, equipment and storage medium - Google Patents
CPU work control method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN110968403A CN110968403A CN201811142796.9A CN201811142796A CN110968403A CN 110968403 A CN110968403 A CN 110968403A CN 201811142796 A CN201811142796 A CN 201811142796A CN 110968403 A CN110968403 A CN 110968403A
- Authority
- CN
- China
- Prior art keywords
- cpu
- network card
- interrupt mode
- card queue
- interrupt
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 238000004590 computer program Methods 0.000 claims description 10
- 238000006243 chemical reaction Methods 0.000 claims description 5
- 238000012545 processing Methods 0.000 abstract description 7
- 230000000694 effects Effects 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000004883 computer application Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000005059 dormancy Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000012725 vapour phase polymerization Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a CPU work control method, which comprises the following steps: controlling the CPU to perform one-time traversal on each network card queue to receive a data packet; determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time; if yes, controlling the CPU to enter an interrupt mode; and when the CPU is in an interrupt mode, if the situation that at least one network card queue has a data packet comes is monitored, repeatedly executing the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packet. By applying the technical scheme provided by the embodiment of the invention, the CPU can be prevented from always running at full speed, the processing capacity is avoided being wasted, the performance can be ensured to the greatest extent, and the CPU occupancy rate can be reduced. The invention also discloses a CPU work control device, equipment and a storage medium, and has corresponding technical effects.
Description
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method, an apparatus, a device, and a storage medium for controlling CPU operations.
Background
With the rapid development of internet technology and the rapid projection of cloud industry, infrastructure network systems gradually merge into an architecture based on a general computing platform. The firewall architecture in the network system is also converted from the Linux kernel forwarding-based mode to the DPDK + VPP-based mode.
The DPDK (Data Plane Development Kit) provides a library function and a driver support for user-space efficient packet processing under the architecture of an Intel Architecture (IA). DPDK + VPP (Vector Packet Processor) is a DPDK-based extensible framework platform that achieves the advantages of high performance, mature technology, modularity, flexibility, and rich functionality.
Despite the many advantages of VPPs, problems still remain. The CPU in the native VPP only supports the polling mode during working, so that the CPU always runs at full speed, the occupancy rate is always 100 percent, the condition of low-load running under a high-speed port is easy to occur, and the waste of processing capacity is serious.
Disclosure of Invention
The invention aims to provide a CPU work control method, a device, equipment and a storage medium, which can reduce the CPU occupancy rate and avoid the waste of processing capacity while ensuring the performance to the maximum extent.
In order to solve the technical problems, the invention provides the following technical scheme:
a CPU work control method comprises the following steps:
controlling the CPU to perform one-time traversal on each network card queue to receive a data packet;
determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time;
if yes, controlling the CPU to enter the interrupt mode;
and when the CPU is in the interrupt mode, if the situation that a data packet arrives in at least one network card queue is monitored, the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packet is repeatedly executed.
In a specific embodiment of the present invention, the determining whether the CPU enters the interrupt mode according to the number of data packets received from each network card queue at the present time includes:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
In an embodiment of the present invention, when it is determined that the CPU cannot enter the interrupt mode, the method further includes:
and repeatedly executing the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packet.
In a specific embodiment of the present invention, before determining whether the CPU enters the interrupt mode according to the number of data packets received from each network card queue at the present time, the method further includes:
determining whether a hybrid mode is on;
and if so, executing the step of determining whether the CPU enters an interrupt mode according to the number of the data packets received from each network card queue at the current time.
In a specific embodiment of the present invention, when determining that the hybrid mode is turned on, before determining whether the CPU enters the interrupt mode according to the number of data packets received from each network card queue at the present time, the method further includes:
determining whether each network card device is in an available state;
if yes, interrupt event registration is carried out on the network card queue of each network card device, and the CPU is controlled to enter a corresponding interrupt mode based on the registered interrupt events.
In a specific embodiment of the present invention, when it is determined that a network card device is not in an available state, the method further includes:
and restoring the state information corresponding to the network card queue of the network card equipment.
A CPU operation control device comprising:
the data packet receiving module is used for controlling the CPU to perform one-time traversal on each network card queue to receive the data packet;
an interrupt mode entry determining module, configured to determine whether the CPU enters an interrupt mode according to the number of data packets received from each network card queue at the current time; if yes, triggering an interrupt mode to enter a module;
the interrupt mode entering module is used for controlling the CPU to enter the interrupt mode;
and the mode conversion module is used for triggering the data packet receiving module and repeatedly executing the operation of controlling the CPU to perform one-time traversal receiving on each network card queue for the data packet if the CPU is in the interrupt mode and at least one network card queue is monitored to have the data packet coming.
In an embodiment of the present invention, the interrupt mode entry determining module is specifically configured to:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
In a specific embodiment of the present invention, the system further includes a repeat trigger module, configured to:
and when the CPU is determined not to be in the interrupt mode, triggering the data packet receiving module to repeatedly execute the operation of controlling the CPU to perform one-time traversal receiving on each network card queue.
In a specific embodiment of the present invention, the method further includes a mixed mode start determining module, configured to:
determining whether a mixed mode is started or not before determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time;
if yes, triggering the interrupt mode entering determining module to execute the operation of determining whether the CPU enters the interrupt mode according to the number of the data packets received from each network card queue at the current time.
In one embodiment of the present invention, the method further comprises:
the network card availability determining module is used for determining whether each network card device is in an available state before determining whether the CPU enters an interrupt mode according to the number of data packets received from each network card queue at the current time when determining that the mixed mode is started; if yes, triggering an interrupt event registration module;
and the interrupt event registration module is used for registering interrupt events for the network card queues of the network card devices so as to control the CPU to enter a corresponding interrupt mode based on the registered interrupt events.
In a specific embodiment of the present invention, the apparatus further includes a counting information clearing module, configured to:
and when determining that the network card equipment is not in the available state, restoring the state information corresponding to the network card queue of the network card equipment.
A CPU operation control device comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of any CPU work control method when the computer program is executed.
A computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the CPU operation control methods described above.
By applying the technical scheme provided by the embodiment of the invention, the CPU is controlled to perform one-time traversal on each network card queue to receive the data packets, whether the CPU enters the interrupt mode is determined according to the number of the data packets received from each network card queue at the current time, if yes, the CPU is controlled to enter the interrupt mode, and if the CPU is in the interrupt mode and at least one network card queue is monitored to have the data packets coming, the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packets is repeatedly executed. Whether the CPU enters an interrupt mode is determined based on the number of data packets received from each network card queue at each time, and when the data packets arrive, the CPU is controlled to perform one-time traversal on each network card queue to receive the data packets, so that the phenomenon that the CPU is always in a full-speed running state, the processing capacity is wasted, the performance can be guaranteed to the greatest extent, and meanwhile, the CPU occupancy rate is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of an embodiment of a CPU work control method according to the present invention;
FIG. 2 is a flowchart of another embodiment of a CPU operation control method according to the present invention;
FIG. 3 is a schematic structural diagram of a CPU operation control apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a CPU operation control device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The core of the invention is to provide a CPU work control method, which is mainly applied to network application with tidal effect of flow, namely that the network flow may be very low in some time periods, but the flow state is kept all the time, or applied to a network system with frequent change of the network flow.
Referring to fig. 1, an implementation flowchart of a CPU work control method according to an embodiment of the present invention is shown, where the method may include the following steps:
s110: and controlling the CPU to perform one-time traversal on each network card queue to receive the data packet.
In practical applications, a network system may be configured with a plurality of network card devices, and each network card device may have a plurality of network card queues for storing data packets coming in and going out of the network system. The data packets in each network card queue need to be further forwarded after being processed by a firewall. The CPU performs one traversal on each network card queue to receive the data packet in each network card queue. Specifically, the packet receiving operation may be performed by calling a dpdk _ device _ input function.
S120: and determining whether the CPU enters an interrupt mode or not according to the number of the data packets received from each network card queue at the current time.
After the CPU performs one traversal on each network card queue to receive the data packets in each network card queue, the number of data packets received from each network card queue at the current time can be obtained. And further determining whether the CPU enters an interrupt mode according to the number of the data packets received from each network card queue at the current time.
It can be understood that if the number of the data packets received from at least one network card queue is not 0, it indicates that traffic is generated in the current network application scenario, and conversely, if the number of the data packets received from all the network card queues is 0, it indicates that traffic is not generated temporarily in the current network application scenario.
In one embodiment of the present invention, step S120 may include the following steps:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
In the embodiment of the present invention, a target desired value may be preset. After the CPU performs one-time traversal on each network card queue to receive the data packets, the number of the data packets received from each network card queue at the current time can be obtained, the obtained number of the data packets received from each network card queue at the current time is compared with a preset target expected value, if the number of the data packets received from each network card queue at the current time is smaller than the target expected value, the current network system has less flow, and the CPU can be determined to enter an interrupt mode.
For example, after the CPU performs one traversal on each network card queue to receive the data packets, it is determined that the number of the data packets received from the network card queue 1 of the network card device 1 is 301, the number of the data packets received from the network card queue 3 of the network card device 1 is 320, and the number of the data packets received from the network card queue 1 of the network card device 2 is 330. If the preset target expectation value is 350, it can be seen that the above numbers are all smaller than the target expectation value, in which case it can be determined that the CPU enters the interrupt mode.
The desired target value may be set and adjusted according to actual conditions, which is not limited in the embodiment of the present invention.
After determining that the CPU enters the interrupt mode, the operation of step S130 may be continuously performed. If it is determined that the CPU cannot enter the interrupt mode, the operation of step S110 may be repeatedly executed, and the CPU is continuously controlled to perform one traversal on each network card queue to receive the data packet, as shown in fig. 1.
S130: and controlling the CPU to enter an interrupt mode.
After the CPU is determined to enter the interrupt mode according to the number of the data packets received from each network card queue at the present time, the CPU can be controlled to enter the interrupt mode, and specifically, a dpdk _ rx _ interrupt function can be called to enter the interrupt mode. Under the condition, the CPU is in a dormant state, and even when the time interval for calling the packet receiving function is reached, the CPU does not traverse each network card queue to receive the data packet any more and waits for the arrival of the next flow.
S140: when the CPU is in the interrupt mode, if it is monitored that at least one network card queue has a data packet coming, step S110 is repeatedly executed to control the CPU to perform an operation of receiving the data packet in one traversal for each network card queue.
When the CPU is in the interrupt mode, the operation of traversing each network card queue to receive the data packet is not executed. In this case, each network card queue may be monitored. If it is monitored that at least one network card queue has a data packet, it indicates that the current network system starts to generate traffic, and may control the CPU to call a packet receiving function to perform one-time traversal on each network card queue to receive the data packet, that is, to repeatedly perform the operations of step S110 to step S140, as shown in fig. 1.
In practical application, the control of mode conversion can be performed through the flag bit. After the CPU receives the data packets in one traversal of each network card queue, if the number of the data packets received from each network card queue is smaller than the preset target expected value, the flag position may be set to be the first flag, for example, 0, and the CPU enters the interrupt mode. When the CPU is in an interrupt mode, if at least one network card queue is monitored to have data packets coming, the CPU performs traversal for each network card queue again to receive the data packets, if the number of the data packets received from each network card queue at this time is still smaller than the target expected value, the flag bit is still kept as a first flag, and if the number of the data packets received from each network card queue at this time is larger than or equal to the target expected value, the flag bit is set as a second flag, such as 1. When the CPU calls the packet receiving function to receive the data packet each time, whether the CPU enters an interrupt mode or not can be determined according to the flag bit.
The method provided by the embodiment of the invention controls the CPU to perform one-time traversal on each network card queue to receive the data packets, determines whether the CPU enters the interrupt mode according to the number of the data packets received from each network card queue at the current time, controls the CPU to enter the interrupt mode if the CPU enters the interrupt mode, and repeatedly executes the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packets if the CPU monitors that at least one network card queue has the data packets. Whether the CPU enters an interrupt mode is determined based on the number of data packets received from each network card queue at each time, and when the data packets arrive, the CPU is controlled to perform one-time traversal on each network card queue to receive the data packets, so that the phenomenon that the CPU is always in a full-speed running state, the processing capacity is wasted, the performance can be guaranteed to the greatest extent, and meanwhile, the CPU occupancy rate is reduced.
As shown in fig. 2, in an embodiment of the present invention, before step S120 according to the number of data packets currently received from each network card queue, the method may further include the following steps:
s150: determining whether a hybrid mode is on; if yes, step S120 is executed to determine whether the CPU enters the interrupt mode according to the number of packets received from each network card queue at the present time.
In the embodiment of the present invention, according to an actual situation, the operating mode of the CPU may be configured through a configuration file, for example, the operating mode of the CPU is configured as a polling mode, in this mode, the CPU always polls to receive a data packet, for example, the operating mode of the CPU is configured as a mixed mode, and in this mode, the CPU may perform a conversion of an interrupt mode.
And inquiring the configuration file to determine whether the mixed mode is started, and if so, continuing to execute the operation of determining whether the CPU enters an interrupt mode according to the number of the data packets received from each network card queue at the current time. If not, the CPU may be controlled to perform polling operation on each network card queue to receive the data packet, as shown in fig. 2.
Referring to fig. 2, in an embodiment of the present invention, when determining that the hybrid mode is turned on, before step S120, the method may further include the steps of:
s160: determining whether each network card device is in an available state; if yes, go to step S170;
s170: carrying out interrupt event registration on a network card queue of each network card device so as to control a CPU to enter a corresponding interrupt mode based on the registered interrupt event;
s180: and when determining that the network card equipment is not in the available state, restoring the state information corresponding to the network card queue of the network card equipment.
In the embodiment of the present invention, when determining that the hybrid mode is turned on, before step S120, it may be determined whether each network card device is started and is in an available state. If so, performing interrupt registration on the network card queue of each network card device, and specifically, calling an event _ register function to perform interrupt registration on the read-in event of the network card queue of each network card device. In this way, the CPU can be controlled to enter a corresponding interrupt mode based on the registered interrupt event.
When it is determined that a network card device is not in the available state, the state information corresponding to the network card queue of the network card device may be restored, as shown in fig. 2, so that when the network card device is in the available state again, the number of data packets received from the network card queue of the network card device is used as a basis for determining whether the CPU enters the interrupt mode.
In the embodiment of the invention, the network card queues can be traversed to receive the data packets under the condition of flow, the performance is ensured to the maximum, the strategy can be changed to enter the interrupt mode for dormancy under the condition of less flow, and the CPU occupancy rate is reduced. And the current CPU occupancy rate can be dynamically adjusted according to the flow, and meanwhile, the CPU occupancy rate can reflect the flow condition of the current network system to a certain extent.
Corresponding to the above method embodiment, the embodiment of the present invention further provides a CPU work control device, and a CPU work control device described below and a CPU work control method described above may be referred to in correspondence.
Referring to fig. 3, the apparatus may include the following modules:
a data packet receiving module 310, configured to control the CPU to perform one-time traversal on each network card queue to receive a data packet;
an interrupt mode entry determining module 320, configured to determine whether the CPU enters an interrupt mode according to the number of data packets received from each network card queue at the current time; if so, triggering an interrupt mode entry module 330;
an interrupt mode entering module 330, configured to control the CPU to enter an interrupt mode;
and the mode conversion module 340 is configured to, when the CPU is in the interrupt mode, trigger the data packet receiving module 310 if it is monitored that a data packet arrives in at least one network card queue, and repeatedly execute an operation of controlling the CPU to perform one-time traversal of each network card queue to receive the data packet.
The device provided by the embodiment of the invention controls the CPU to perform one-time traversal on each network card queue to receive the data packets, determines whether the CPU enters the interrupt mode according to the number of the data packets received from each network card queue at the current time, controls the CPU to enter the interrupt mode if the CPU enters the interrupt mode, and repeatedly executes the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packets if the CPU monitors that at least one network card queue has the data packets. Whether the CPU enters an interrupt mode is determined based on the number of data packets received from each network card queue at each time, and when the data packets arrive, the CPU is controlled to perform one-time traversal on each network card queue to receive the data packets, so that the phenomenon that the CPU is always in a full-speed running state, the processing capacity is wasted, the performance can be guaranteed to the greatest extent, and meanwhile, the CPU occupancy rate is reduced.
In an embodiment of the present invention, the interrupt mode entry determining module 320 is specifically configured to:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
In a specific embodiment of the present invention, the system further includes a repeat trigger module, configured to:
when determining that the CPU cannot enter the interrupt mode, the data packet receiving module 310 is triggered to repeatedly execute an operation of controlling the CPU to perform one-time traversal of each network card queue to receive the data packet.
In a specific embodiment of the present invention, the method further includes a mixed mode start determining module, configured to:
determining whether a mixed mode is started or not before determining whether a CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time;
if yes, triggering an interrupt mode entering determining module to execute the operation of determining whether the CPU enters the interrupt mode according to the number of the data packets received from each network card queue at the current time.
In one embodiment of the present invention, the method further comprises:
the network card availability determining module is used for determining whether each network card device is in an available state or not before determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time when the mixed mode is determined to be started; if yes, triggering an interrupt event registration module;
and the interrupt event registration module is used for registering interrupt events for the network card queues of the network card devices so as to control the CPU to enter a corresponding interrupt mode based on the registered interrupt events.
In a specific embodiment of the present invention, the apparatus further includes a counting information clearing module, configured to:
and when determining that the network card equipment is not in the available state, restoring the state information corresponding to the network card queue of the network card equipment.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a CPU operation control device, as shown in fig. 4, including:
a memory 410 for storing a computer program;
the processor 420 is configured to implement the steps of the CPU operation control method when executing the computer program.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above CPU operation control method.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The principle and the implementation of the present invention are explained in the present application by using specific examples, and the above description of the embodiments is only used to help understanding the technical solution and the core idea of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Claims (14)
1. A CPU work control method is characterized by comprising the following steps:
controlling the CPU to perform one-time traversal on each network card queue to receive a data packet;
determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time;
if yes, controlling the CPU to enter the interrupt mode;
and when the CPU is in the interrupt mode, if the situation that a data packet arrives in at least one network card queue is monitored, the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packet is repeatedly executed.
2. The CPU work control method according to claim 1, wherein the determining whether the CPU enters the interrupt mode according to the number of packets currently received from each network card queue includes:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
3. The CPU operation control method according to claim 1, upon determining that the CPU cannot enter the interrupt mode, further comprising:
and repeatedly executing the operation of controlling the CPU to perform one-time traversal on each network card queue to receive the data packet.
4. The CPU work control method according to any one of claims 1 to 3, wherein before determining whether the CPU enters the interrupt mode according to the number of packets received from each network card queue at the present time, the method further comprises:
determining whether a hybrid mode is on;
and if so, executing the step of determining whether the CPU enters an interrupt mode according to the number of the data packets received from each network card queue at the current time.
5. The CPU work control method according to claim 4, wherein when determining that the hybrid mode is on, before determining whether the CPU enters the interrupt mode according to the number of packets received from each network card queue at the present time, the method further comprises:
determining whether each network card device is in an available state;
if yes, interrupt event registration is carried out on the network card queue of each network card device, and the CPU is controlled to enter a corresponding interrupt mode based on the registered interrupt events.
6. The CPU work control method according to claim 5, when it is determined that there is a network card device that is not in the available state, further comprising:
and restoring the state information corresponding to the network card queue of the network card equipment.
7. A CPU operation control device, comprising:
the data packet receiving module is used for controlling the CPU to perform one-time traversal on each network card queue to receive the data packet;
an interrupt mode entry determining module, configured to determine whether the CPU enters an interrupt mode according to the number of data packets received from each network card queue at the current time; if yes, triggering an interrupt mode to enter a module;
the interrupt mode entering module is used for controlling the CPU to enter the interrupt mode;
and the mode conversion module is used for triggering the data packet receiving module and repeatedly executing the operation of controlling the CPU to perform one-time traversal receiving on each network card queue for the data packet if the CPU is in the interrupt mode and at least one network card queue is monitored to have the data packet coming.
8. The CPU work control device according to claim 7, wherein the interrupt mode entry determining module is specifically configured to:
and if the number of the data packets received from each network card queue at the current time is less than the preset target expected value, determining that the CPU enters an interrupt mode.
9. The CPU work control device of claim 7, further comprising a repeat trigger module for:
and when the CPU is determined not to be in the interrupt mode, triggering the data packet receiving module to repeatedly execute the operation of controlling the CPU to perform one-time traversal receiving on each network card queue.
10. The CPU operation control device according to any one of claims 7 to 9, further comprising a mixed mode start determination module configured to:
determining whether a mixed mode is started or not before determining whether the CPU enters an interrupt mode or not according to the number of data packets received from each network card queue at the current time;
if yes, triggering the interrupt mode entering determining module to execute the operation of determining whether the CPU enters the interrupt mode according to the number of the data packets received from each network card queue at the current time.
11. The CPU operation control device according to claim 10, further comprising:
the network card availability determining module is used for determining whether each network card device is in an available state before determining whether the CPU enters an interrupt mode according to the number of data packets received from each network card queue at the current time when determining that the mixed mode is started; if yes, triggering an interrupt event registration module;
and the interrupt event registration module is used for registering interrupt events for the network card queues of the network card devices so as to control the CPU to enter a corresponding interrupt mode based on the registered interrupt events.
12. The CPU work control device according to claim 11, further comprising a count information clearing module configured to:
and when determining that the network card equipment is not in the available state, restoring the state information corresponding to the network card queue of the network card equipment.
13. A CPU operation control apparatus characterized by comprising:
a memory for storing a computer program;
a processor for implementing the steps of the CPU operation control method according to any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the CPU operation control method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811142796.9A CN110968403A (en) | 2018-09-28 | 2018-09-28 | CPU work control method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811142796.9A CN110968403A (en) | 2018-09-28 | 2018-09-28 | CPU work control method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110968403A true CN110968403A (en) | 2020-04-07 |
Family
ID=70027921
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811142796.9A Pending CN110968403A (en) | 2018-09-28 | 2018-09-28 | CPU work control method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110968403A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111580949A (en) * | 2020-04-30 | 2020-08-25 | 成都安恒信息技术有限公司 | Automatic network packet receiving mode adjusting method |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050097226A1 (en) * | 2003-10-31 | 2005-05-05 | Sun Microsystems, Inc. | Methods and apparatus for dynamically switching between polling and interrupt to handle network traffic |
CN103440213A (en) * | 2013-07-23 | 2013-12-11 | 深圳市共进电子股份有限公司 | Network card driving method applied to system with multiple CPUs (Central Processing Unit) and network cards |
CN105786674A (en) * | 2016-03-24 | 2016-07-20 | 华为技术有限公司 | Scheduling method and electronic device |
CN106375239A (en) * | 2016-08-25 | 2017-02-01 | 北京智芯微电子科技有限公司 | Network data reception processing method and apparatus |
CN107005531A (en) * | 2014-12-22 | 2017-08-01 | 英特尔公司 | Technology for the power management associated with the packet that processing is received at the network equipment |
CN108062269A (en) * | 2017-12-05 | 2018-05-22 | 上海交通大学 | A kind of computing resource elastic telescopic method and system based on DPDK |
CN108345502A (en) * | 2018-01-15 | 2018-07-31 | 中兴飞流信息科技有限公司 | Resource regulating method, device, terminal device based on DPDK and readable storage medium storing program for executing |
-
2018
- 2018-09-28 CN CN201811142796.9A patent/CN110968403A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050097226A1 (en) * | 2003-10-31 | 2005-05-05 | Sun Microsystems, Inc. | Methods and apparatus for dynamically switching between polling and interrupt to handle network traffic |
CN103440213A (en) * | 2013-07-23 | 2013-12-11 | 深圳市共进电子股份有限公司 | Network card driving method applied to system with multiple CPUs (Central Processing Unit) and network cards |
CN107005531A (en) * | 2014-12-22 | 2017-08-01 | 英特尔公司 | Technology for the power management associated with the packet that processing is received at the network equipment |
CN105786674A (en) * | 2016-03-24 | 2016-07-20 | 华为技术有限公司 | Scheduling method and electronic device |
CN106375239A (en) * | 2016-08-25 | 2017-02-01 | 北京智芯微电子科技有限公司 | Network data reception processing method and apparatus |
CN108062269A (en) * | 2017-12-05 | 2018-05-22 | 上海交通大学 | A kind of computing resource elastic telescopic method and system based on DPDK |
CN108345502A (en) * | 2018-01-15 | 2018-07-31 | 中兴飞流信息科技有限公司 | Resource regulating method, device, terminal device based on DPDK and readable storage medium storing program for executing |
Non-Patent Citations (4)
Title |
---|
TIAN ZHIHONG: "Semi-polling based interrupt mitigation for high performance packet processing", 《HIGH TECHNOLOGY LETTERS (ENGLISH LANGUAGE EDITION)》 * |
刘荣辉: "《大数据架构技术与实例分析》", 31 January 2018, 东北师范大学出版社 * |
施云波: "《普通高等教育物联网工程专业"十三五"规划教材 无线传感器网络技术概论》", 31 October 2017, 西安电子科技大学出版社 * |
程浩宇: "高速网络数据捕获技术的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111580949A (en) * | 2020-04-30 | 2020-08-25 | 成都安恒信息技术有限公司 | Automatic network packet receiving mode adjusting method |
CN111580949B (en) * | 2020-04-30 | 2023-08-22 | 成都安恒信息技术有限公司 | Automatic regulating method for network packet receiving mode |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110968402A (en) | CPU work control method, device, equipment and storage medium | |
US20160378570A1 (en) | Techniques for Offloading Computational Tasks between Nodes | |
US7836195B2 (en) | Preserving packet order when migrating network flows between cores | |
US8510403B2 (en) | Self clocking interrupt generation in a network interface card | |
CN112532538A (en) | Flow control method and device, electronic equipment and computer readable storage medium | |
CN111107012B (en) | Multi-dimensional centralized flow control method and system | |
CN111782368B (en) | Interrupt nesting processing method, device, terminal and storage medium | |
CN114553780A (en) | Load balancing method and device and network card | |
CN109379246B (en) | Memory detection method and device | |
US10467161B2 (en) | Dynamically-tuned interrupt moderation | |
WO2005101769A1 (en) | Configuration of redirection tables | |
CN110557432B (en) | Cache pool balance optimization method, system, terminal and storage medium | |
CN110968403A (en) | CPU work control method, device, equipment and storage medium | |
Lin et al. | {RingLeader}: efficiently Offloading {Intra-Server} Orchestration to {NICs} | |
CN110147254A (en) | A kind of data buffer storage processing method, device, equipment and readable storage medium storing program for executing | |
CN111314249B (en) | Method and server for avoiding data packet loss of 5G data forwarding plane | |
CN112214299A (en) | Multi-core processor and task scheduling method and device thereof | |
WO2019004880A1 (en) | Power management of an event-based processing system | |
WO2019167859A1 (en) | Estimating device and estimating method | |
US7707344B2 (en) | Interrupt mitigation on multiple network adapters | |
US11003506B2 (en) | Technique for determining a load of an application | |
CN115514708A (en) | Congestion control method and device | |
CN111427673B (en) | Load balancing method, device and equipment | |
CN114661415A (en) | Scheduling method and computer system | |
CN114567566A (en) | Message processing method, device, terminal equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200407 |
|
RJ01 | Rejection of invention patent application after publication |