Method for improving performance of multi-core based on CPU affinity and isolation technology
By isolating the CPU and designating user processes during the system startup phase, the problem of CPU preemption in existing technologies is solved, improving multi-core performance by 5% to 12%.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KYLIN CORP
- Filing Date
- 2026-03-13
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies for improving server performance are complex to implement and cannot prevent system-level service processes and other non-business processes from preempting the CPU bound to the user, resulting in frequent interference with business processes.
By using CPU isolation technology during the system startup phase, a portion of the CPU is isolated for use only by the operating system and necessary system-level processes, and user processes are specified through the kernel interface to automatically allocate isolated CPUs.
Multi-core performance has been improved, with test results showing a performance improvement of 5% to 12%. Specific tests were conducted on a LoongArch desktop using the stream test program.
Smart Images

Figure CN122431858A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of performance improvement technology, and more specifically, to a method for improving multi-core performance based on CPU affinity and isolation technology. Background Technology
[0002] Server products have high performance requirements when deploying applications with extremely high thread counts, such as nginx and MySQL. These applications create a large number of threads during operation. For these enterprise-level applications, maximizing machine performance is a crucial requirement.
[0003] Currently, a common solution to improve performance is to simply bind the application to CPU to improve running efficiency. However, this method is complicated to operate in practice and cannot prevent system-level service processes and other non-business processes from competing for the CPU bound to the user, thus causing frequent interference to business processes.
[0004] Therefore, a solution is needed to address the above problems. Summary of the Invention
[0005] The main objective of this invention is to provide a method for improving multi-core performance based on CPU affinity and isolation technology. This method involves "clearing out" a portion of the CPUs during the system startup phase; that is, using CPU isolation technology to isolate a portion of the CPUs. During system operation, no user processes are allowed to use these CPUs. Subsequently, after system startup, users can pass the name of their user processes to the kernel through the kernel interface, and the kernel automatically assigns the specified user processes to the pre-isolated CPUs.
[0006] This invention relates to a multi-core performance improvement method based on CPU affinity and isolation technology, comprising the following steps: Step S1: When the operating system starts, it identifies the parameters set by the user when booting the kernel of the operating system, sets the number of isolated CPUs based on the parameters, and isolates the CPUs based on the number of isolated CPUs, making them isolated CPUs; Step S2: The operating system completes startup; Step S3: The user specifies the process name that needs to use isolated CPU; Step S4: The operating system automatically allocates isolated CPUs based on the process name.
[0007] A further improvement of the present invention is that the user specifies the process name that needs to use the isolated CPU based on the kernel user interface.
[0008] A further improvement of this invention is that the kernel is the Linux kernel. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a schematic diagram of the process of the present invention. Detailed Implementation
[0011] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Many specific details are set forth in the following description to provide a thorough understanding of the present invention; however, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0012] This invention provides a method for improving multi-core performance based on CPU affinity and isolation technology. The method involves "clearing out" a portion of the CPUs during the system startup phase, specifically by using CPU isolation technology to isolate a subset of CPUs. During system operation, no user processes are allowed to use these CPUs. Subsequently, after system startup, users can pass the names of their user processes to the kernel through the kernel interface, and the kernel automatically assigns the specified user processes to the pre-isolated CPUs.
[0013] Specifically, multi-core performance improvement methods based on CPU affinity and isolation technologies, such as... Figure 1 As shown, it includes the following steps: Step S0: Start the operating system; Step S1: When the operating system starts, it identifies the parameters set by the user when booting the operating system kernel. Specifically, based on CPU isolation technology, it determines the number of isolated CPUs according to the parameters and isolates the CPUs accordingly. These isolated CPUs will not be occupied by other tasks and will always be in a standby state. The system only reports a small number of unisolated CPUs for use by the operating system itself and other necessary system-level processes.
[0014] Step S2: The operating system completes startup; Step S3: The user specifies the process name that needs to use reserved CPU (isolated CPU) based on the Linux kernel user interface; for example: # echo mysql > / sys / kernel / kymem / task. After setting, you can directly run the mysql application process, and the system will automatically allocate reserved CPU for the mysql application process.
[0015] Step S4: The operating system automatically allocates a pre-isolated CPU (isolated CPU) based on the process name.
[0016] Based on the above method, the method was tested on a LoongArch architecture desktop using the stream test program. The test results showed that the multi-core performance was improved by about 5% to 12%.
[0017] The test results are as follows: Before using this method: Function Best Rate MB / s Avg time Min time Max time Copy: 15230.3 0.053434 0.052527 0.054540 Scale: 16801.4 0.049687 0.047615 0.059350 Add: 19731.5 0.077893 0.072680 0.077748 Triad: 19808.8 0.076597 0.075907 0.077196 After using this method: Function Best Rate MB / s Avg time Min time Max time Copy: 16010.2 0.053932 0.049968 0.054118 Scale: 17897.9 0.045268 0.044699 0.046527 Add: 17771.0 0.067935 0.067526 0.068447 Triad: 17832.2 0.067908 0.067294 0.068954.
[0018] Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
Claims
1. A method for improving multi-core performance based on CPU affinity and isolation technology, characterized in that, Includes the following steps: Step S1: When the operating system starts, it identifies the parameters set by the user when booting the kernel of the operating system, sets the number of isolated CPUs based on the parameters, and isolates the CPUs based on the number of isolated CPUs, making them isolated CPUs; Step S2: The operating system completes startup; Step S3: The user specifies the process name that needs to use isolated CPU; Step S4: The operating system automatically allocates isolated CPUs based on the process name.
2. The multi-core performance improvement method based on CPU affinity and isolation technology according to claim 1, characterized in that, Users specify the process names that require the use of isolated CPUs through the user interface based on the operating system kernel.
3. The multi-core performance improvement method based on CPU affinity and isolation technology according to claim 1, characterized in that, The kernel is the Linux kernel.