A Linux kernel IO throttling adaptive set point control method and system

By sampling the number of dirty pages and calculating adaptive set points in the Linux kernel, and adjusting the I/O throttling set points according to the page missing rate, the delay problem caused by excessive dirty pages is solved, and more efficient and stable I/O performance is achieved.

CN119336515BActive Publication Date: 2025-03-28KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411875592.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-28
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

There are problems in the Linux kernel that too many dirty pages cause serious delays when applications wait for memory release. The fixed set points of existing I/O throttling technology cannot adapt to the memory characteristics of different workloads, resulting in unstable performance.

Method used

By sampling the percentage of dirty pages in the system, calculate the freely run midpoint value freerun and use its midpoint value to the hard limit ratio as the set point for the percentage of dirty pages in the I/O throttling target. Adjust the set point adaptively according to the page missing rate of the write operation. If the missing rate is less than 100%, increase the set point to retain more dirty pages; otherwise, reduce the set point to reduce the number of dirty pages.

Benefits of technology

Dynamically adjust the I/O throttling set points, improve write operation performance, enhance system stability, avoid long IO lags, adapt to the memory characteristics of different workloads, and achieve better performance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336515B_ABST
    Figure CN119336515B_ABST
Patent Text Reader

Abstract

The present invention provides a Linux kernel IO throttling adaptive set point control method and system, which sets a midpoint value freerun and a set point; uses the counting information refault as the number of missed pages to calculate the page miss rate of a write operation; uses the difference between the page miss rate and 100% as the adaptive adjustment value of the set point; if the page miss rate is less than 100%, increases the set point, and the increase value is the adaptive adjustment value, so that more dirty pages remain in the memory; conversely, if the page miss rate is greater than 100%, decreases the set point, and the decrease value is the adaptive adjustment value. The present invention converts the restriction on the number of dirty pages into the restriction on the page miss rate of a write operation, and the size of the restriction value can be adaptively adjusted. The IO is limited to a stable degree by automatic adjustment, thereby enhancing the stability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of information technology, and in particular relates to a Linux kernel IO throttling adaptive set point control method and system. Background Art

[0002] Due to the existence of cache (Page Cache) in the Linux kernel, the modified file data is generally not synchronized to the disk immediately, but cached in the Page Cache of the memory. This page that is inconsistent with the disk data is called a dirty page (DirtyPage), and the dirty page will be synchronized to the disk at the appropriate time.

[0003] There is a problem in the Linux kernel memory management system that when a large portion of the system pages are dirty pages, the asynchronous recycling process and the direct recycling process cannot recycle dirty pages immediately, which may cause serious delays in applications while waiting for the freed memory space. To address this concern, the Linux kernel currently uses I / O throttling technology to limit the number of dirty pages to a certain number. The purpose of I / O throttling is to prevent the number of dirty pages from exceeding the hard limit ratio of total memory. This hard limit ratio is a user-adjustable value, which defaults to 20%. It means that if the write thread is creating a large number of dirty pages, when the ratio of the number of dirty pages to the maximum system memory reaches this set value, the thread must submit all dirty data to disk and will be forced to sleep before the write operation is completed. At the same time, all new I / O blocks will be blocked until the dirty data is written to disk to reduce the number of dirty pages created per unit time. This is usually the cause of long I / O jams, but it is also a protection mechanism to ensure that there is no excessive dirty data in memory. In the Linux kernel, vm.dirty_background_ratio and vm.dirty_ratio are usually used to control the impact of dirty pages on the file system cache. The Linux kernel writes disk to the cache and then asynchronously refreshes them to the disk after a while. This has a good effect on accelerating disk IO, but when data is not written to the disk, the possibility of data loss increases. If too much data is written to the disk at one time, the cache will be overwritten, causing the system to freeze. The freeze occurs because the system thinks that the cache is too large and cannot be written to the disk in an asynchronous way, so it is blocked and switches to synchronous writing.

[0004] vm.dirty_ratio is the hard limit ratio of throttling, the default is 20%, which controls the size of the file system's write buffer, expressed in percentage, representing the percentage of system memory. When the write buffer uses a certain amount of system memory, data starts to be written to disk. Increasing it will use more system memory for disk write buffering, which can also greatly improve the system's write performance, but when continuous and constant writes are required, its value should be reduced.

[0005] vm.dirty_background_ratio is the background limit ratio of dirty pages. The default value is 10%. The unit is percentage. It is the percentage of system memory that can be filled with dirty data. It controls the pdflush process of the file system and when to refresh the disk. pdflush is used to synchronize the contents in the memory with the file system. For example, when the system has 32G memory, a file is modified in the memory, and there are 3.2G of dirty data waiting in the memory. pdflush is responsible for writing it back to the hard disk. Whenever the dirty pages in the memory exceed 10%, that is, more than 3.2G, there will be a background process to clean up. pdflush will back up these pages to the hard disk. Increasing the value will use more system memory for disk write buffering, which can also greatly improve the system's write performance. However, if a continuous and constant write scenario is required, this value needs to be reduced.

[0006] In order to verify whether the default setting of the hard limit ratio of 20% is appropriate, the single variable control principle is adopted to fix the background limit ratio of dirty pages, and the value of the hard limit ratio is fixed to 60% and 100%, and the performance of these three cases is tested in different FIO test cases. The experiment found that compared with the default 20%, when the hard limit ratio is set to 100%, the performance of some test cases is improved, but at the same time, the performance of other test cases drops sharply. Analysis shows that this phenomenon is caused by the existence of a large number of dirty pages; at the same time, when the hard limit ratio is set to 60%, some performance drops while the data of some test scenarios show performance improvement. Obviously, this confirms that the hard limit ratio of 20% is not an optimal setting value. It does not take into account the memory characteristics of the workload being executed. Therefore, it is unreasonable to set a fixed hard limit ratio of 20%. A good throttling point should be set according to the actual situation of the system, and it is best to be adaptive and dynamically adjusted, so as to meet the system's adaptation needs for multi-tasking and complex scenarios and obtain better stability and better performance. Summary of the invention

[0007] The purpose of the present invention is to provide a Linux kernel IO throttling adaptive set point control method and system, which converts the limit on the number of dirty pages into a limit on the page miss rate of write operations. The size of the limit value can be adaptively adjusted, and the IO is limited to a stable level through automatic adjustment, thereby enhancing the stability of the system.

[0008] In order to achieve the above object, the technical solution of the present invention is as follows:

[0009] A Linux kernel IO throttling adaptive set point control method, comprising:

[0010] S1. Sample the percentage of dirty pages in the Linux system, and calculate the midpoint value freerun of the system's free operation according to the values ​​of the background limit ratio vm.dirty_background_ratio and the hard limit ratio vm.dirty_ratio. The midpoint value of freerun and the hard limit ratio vm.dirty_ratio is used as the setting point of the percentage of dirty pages of the I / O throttling target; if the percentage of dirty pages is greater than freerun, jump to step S2, otherwise continue sampling;

[0011] S2, taking the count information of the page that is missing again after the cache page is evicted as the number of missed pages, and obtaining the page miss rate of the write operation by calculating the percentage of the number of missed pages and the number of written pages; and taking the difference between the page miss rate and 100% as the adaptive adjustment value of the set point;

[0012] S3. If the page miss rate is less than 100%, increase the set point by the adaptive adjustment value to allow more dirty pages to remain in the memory; conversely, if the page miss rate is greater than 100%, decrease the set point by the adaptive adjustment value.

[0013] Furthermore, step S3 also includes:

[0014] S301, presetting the adaptive adjustment period of the set point;

[0015] S302, after each calculation of the adaptive adjustment value of the set point is completed, determine whether the adaptive adjustment of the set point is within the adaptive adjustment cycle, if it is within the adaptive adjustment cycle, do not perform, otherwise jump to step S303;

[0016] S303, obtaining the value of the current hard limit ratio vm.dirty_ratio of the system;

[0017] S304. Define the adaptive adjustment limit of the set point, and use the ratio of the remaining size after subtracting the number of currently unoccupied pages from the total number of pages in the system as the upper limit of the adaptive adjustment of the set point, and the hard limit ratio vm.dirty_ratio as the lower limit of the adaptive adjustment of the set point. After the adaptive adjustment of the set point, the set point does not exceed the range of the upper and lower limits.

[0018] Furthermore, in step S304, if the set point exceeds the range of the upper limit or the lower limit after adaptive adjustment, the upper limit or the lower limit is used for replacement.

[0019] Furthermore, in step S3, a margin is set, and the adjustment size of the set point is the adaptive adjustment value minus the margin.

[0020] Another aspect of the present invention further provides a Linux kernel IO throttling adaptive set point control system, comprising:

[0021] Setpoint module: samples the percentage of dirty pages in the Linux system, and calculates the midpoint value freerun of the system's free operation based on the background limit ratio vm.dirty_background_ratio and the hard limit ratio vm.dirty_ratio. The midpoint value of freerun and the hard limit ratio vm.dirty_ratio is used as the set point for the percentage of dirty pages of the I / O throttling target; if the percentage of dirty pages is greater than freerun, jump to the miss rate module, otherwise continue sampling;

[0022] Miss rate module: taking the count information of the page that is missing again after the cache page is evicted as the number of missed pages, and calculating the percentage of the number of missed pages and the number of written pages to obtain the page miss rate of the write operation; taking the difference between the page miss rate and 100% as the adaptive adjustment value of the set point;

[0023] Adjustment module: If the page miss rate is less than 100%, the set point is increased, and the increased adaptive adjustment value is the adaptive adjustment value, so that more dirty pages remain in the memory; conversely, if the page miss rate is greater than 100%, the set point is reduced, and the reduced adaptive adjustment value is the adaptive adjustment value.

[0024] Furthermore, the adjustment module includes:

[0025] Periodic unit: presetting the adaptive adjustment period of the set point;

[0026] Judgment unit: after each calculation of the adaptive adjustment value of the set point is completed, determine whether the adaptive adjustment of the set point is within the adaptive adjustment period, if it is within the adaptive adjustment period, do not execute, otherwise jump to the acquisition unit;

[0027] Get unit: Get the value of the current hard limit ratio vm.dirty_ratio of the system;

[0028] Boundary unit: defines the adaptive adjustment limit of the set point, and uses the ratio of the remaining size after subtracting the number of currently unoccupied pages from the total number of pages in the system as the upper limit of the adaptive adjustment of the set point, and the hard limit ratio vm.dirty_ratio as the lower limit of the adaptive adjustment of the set point. After the adaptive adjustment of the set point, the set point does not exceed the range of the upper and lower limits.

[0029] Furthermore, in the limit unit, if the set point exceeds the range of the upper limit or the lower limit after adaptive adjustment, the upper limit or the lower limit is used for replacement.

[0030] Furthermore, a margin is set in the adjustment module, and the adjustment size of the set point is the adaptive adjustment value minus the margin.

[0031] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned Linux kernel IO throttling adaptive set point control method.

[0032] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the above-mentioned Linux kernel IO throttling adaptive set point control method.

[0033] Compared with the prior art, the present invention has the following beneficial effects:

[0034] 1. The Linux kernel IO throttling adaptive set point control method and system proposed by the present invention dynamically changes the set point according to the current dirty page status to improve write performance. The restriction on the number of dirty pages is converted into a restriction on the page miss rate of write operations, and the difference between the page miss rate and 100% is used as the size of the set point adaptive adjustment. If the miss rate is less than 100%, the set point is increased to keep more dirty pages in the memory and improve the hit rate of the write operation cache; otherwise, there is no need to keep many dirty pages, and the set point is reduced to provide an appropriate trade-off between write performance and the performance of other operations.

[0035] 2. To calculate the set point without any performance degradation, the present invention utilizes the existing values ​​collected by the kernel without any additional monitoring tasks. The value of the atomic variable refault is used to replace the number of cache page misses, and then the page miss rate of the write operation is calculated.

[0036] 3. In order to prevent frequent set point changes, the present invention defines an adaptive adjustment cycle for the set point. Even if throttling is frequently performed, the set point is changed only one adaptive adjustment cycle after the last set point change.

[0037] 4. To avoid a sudden increase in memory from other tasks, the present invention adds a margin to the set point, so that the actual set point is smaller than the calculated set point, leaving a certain margin space for non-dirty pages.

[0038] 5. The present invention adaptively adjusts the size of the set point by comparing the difference between the page cache miss rate of the write operation and 100%, adjusts the number of target dirty pages in the system, limits the IO flow rate to a stable level, improves the write performance of the system, enhances the stability of the system, prevents blocking and long IO jams, and ensures the stability of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a schematic diagram of the principle of an embodiment of the present invention.

[0040] Figure 2 It is a schematic diagram of a method flow of an embodiment of the present invention.

[0041] Figure 3 Schematic diagram of the adaptive set point control method model of the embodiment of the present invention. DETAILED DESCRIPTION

[0042] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0043] In order to enable those skilled in the art to better understand the present application, the following will take a platform using a PHYTIUM processor and running the Kylin operating system as an example to clearly and completely describe the technical solution in a Linux kernel IO throttling adaptive set point control method and system of the present invention. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application. It should also be noted that a Linux kernel IO throttling adaptive set point control method and system of the present invention is applicable to all Linux kernels that use an IO throttling mechanism for memory management, and is not dependent on the specific processor or Linux operating system version used.

[0044] The principle of this embodiment is as follows Figure 1As shown in the figure, it is divided into three parts: information acquisition, set point calculation and set point adjustment. The first part is mainly to obtain the number of dirty pages, the hard limit ratio and the background limit ratio, and calculate the freerun and set point values; the second part is to design an indicator to consider whether the system needs to perform IO throttling operations, and use the page miss rate of write operations as a value reflecting the number of dirty pages in the system, so as to adjust the throttling set point, and use the number of write pages as the total number of page cache accesses for write operations. In order not to set up additional monitoring programs and reduce the performance loss of the program, the value of the kernel's atomic variable refault is directly obtained as the total number of missed pages to participate in the function calculation, and the page cache miss rate of write operations is obtained. Finally, the third part uses the difference between the page miss rate of write operations and 100% as the adjustment range. Before sending an adjustment signal, check whether the adjustment of the set point exceeds the set adaptive adjustment cycle and whether it is within the set effective adjustment range. If so, send an adjustment signal to change the size of the set point, otherwise it will not be processed.

[0045] Based on the above principles, Figure 2 As shown, a Linux kernel IO throttling adaptive set point control method in this embodiment includes:

[0046] S1. Sampling the percentage of dirty pages in the system: In the Linux system, the value of the nr_dirty record can be directly obtained by saving it through atomic variables, and the value can be divided by the total number of pages in the system memory to obtain the percentage of dirty pages, which is convenient for the subsequent monitoring of the number of dirty pages. At the same time, according to the values ​​of vm.dirty_background_ratio and vm.dirty_ratio, the midpoint value freerun of the system's free operation and the size of the set point of the I / O throttling target dirty page percentage are calculated. The set point is set to the midpoint value of freerun and the hard limit ratio vm.dirty_ratio. If the percentage of dirty pages is greater than the midpoint value freerun, it is considered that throttling is required, and jump to step S2, otherwise continue sampling;

[0047] In this embodiment, the percentage of dirty pages in the system sampled in step S1 is obtained by dividing the number of dirty pages by the total number of pages in the system and then multiplying by 100%, which can be expressed as:

[0048] Percentage of dirty pages = (number of dirty pages / total number of system pages) × 100%.

[0049] S2, by calculating the percentage of the number of missed pages and the number of written pages, the number of written pages is taken as the total number of page cache accesses for write operations, and the count information of the pages that are missing again after the cache page is evicted is taken as the number of missed pages, and the substitution here is rough, and refault includes all accesses caused by read and anonymous pages. The page miss rate of the write operation is obtained according to their percentage values, and the difference between the page miss rate and 100% is taken as the adaptive adjustment value of the set point, and then jump to step S3;

[0050] S3, according to the page miss rate of the write operation obtained in step S2, since the atomic variable refault value of the kernel is used in the calculation to replace the number of missed pages to participate in the calculation, refault includes all accesses caused by read and anonymous pages, that is, it includes the remaining data that affects the value size, so the page miss rate of the write operation may be greater than 100%. If the page miss rate of the write operation is less than 100%, it means that the write operation cache hit rate is low and the number of dirty pages is small. It is necessary to increase the value of the set point to keep more dirty pages in the memory and improve the hit rate of the write operation cache; on the contrary, if the page miss rate is greater than 100%, it means that there are many dirty pages in the system, the write operation cache hit rate is high, and there is no need to retain many dirty pages, then it is necessary to reduce the value of the set point, thereby reducing the number of dirty pages in the system to ensure the normal operation of the system. The difference between the increase or decrease of the set point is the adaptive adjustment value described in step S2.

[0051] In step S2, the restriction on the number of dirty pages is converted into a restriction on the page miss rate of the write operation. The page miss rate of the write operation reflects the number of dirty pages to a certain extent. The larger the miss rate, the fewer the number of dirty pages, and vice versa. The function expression is:

[0052] ;

[0053] In the above formula, is the page miss rate of write operations, is the number of missed pages, which is replaced by the atomic variable refault used in the kernel. refault indicates the count information of the pages that are missing again after the cache page is evicted; Indicates the total number of page cache accesses for write operations, that is, the number of pages written.

[0054] The method for adaptively adjusting the set point of the page miss rate of the overwrite operation in step S3 specifically includes:

[0055] S301, presetting the adaptive adjustment cycle of the set point to ensure that the set point is not frequently changed and throttling is often performed;

[0056] In this embodiment, the adaptive adjustment period of the set point is set to one second, and is performed in a period of more than one second, during which the page miss rate of the write operation is checked.

[0057] S302, according to the adaptive adjustment cycle set in S301, after each adaptive adjustment value calculation of the set point is completed, determine whether the change of the set point is within the adaptive adjustment cycle, if it is within the adaptive adjustment cycle, do not execute, otherwise jump to step S303, continue to run, and perform throttling operation;

[0058] S303, obtaining the current hard limit ratio vm.dirty_ratio value of the system;

[0059] S304. Define the limits of the adaptive adjustment of the set point. The ratio of the remaining size after deducting the number of currently unoccupied pages from the total number of pages in the system is used as the upper limit of the set point. At the same time, the hard limit ratio vm.dirty_ratio value obtained in S303 is used as the lower limit of the set point. The adaptive adjustment of the set point cannot exceed the range of the upper and lower limits.

[0060] like Figure 3 The adaptive set point control method model of this embodiment shown in FIG. 1 is mainly to adaptively adjust the size of the set point by checking the change of the cache loss rate of the write operation within the adjustable limit range, such as Figure 3 As shown in , according to the position of the freerun point, simply increasing or decreasing the set value of the execution throttling is not comprehensive and does not take into account the performance of other applications. Therefore, in order to enhance the robustness of the method, consider setting the upper limit of the set value to the ratio of the remaining size after subtracting the number of currently unoccupied pages from the total number of pages, and use the value of the hard limit ratio vm.dirty_ratio as the lower limit of the set value. In this way, the number of occupied pages is removed, and pages can be generated quickly without actually performing storage I / O write operations, thereby reducing the occupation of other task working memory. Limit the adjustment of the set point of the throttling control to a reliable range, taking into account the performance of other applications. By adjusting the size of the set point, the number of dirty pages in the system memory is controlled, so that the number of dirty pages is within a relatively reasonable range, with the goal of maximally approaching the set point, ensuring stable and efficient operation of the system, improving IO performance, and avoiding the phenomenon of blocking processes.

[0061] For step S3, this embodiment also proposes a more preferred solution, when the set point increases or decreases the adaptive adjustment value, a margin should be set to allow for a sudden increase in the memory of other tasks, so that the final set point adjustment is less than the calculated adaptive adjustment value. For example, if the calculated adaptive adjustment value is 100%, the set point is finally adjusted to 77.5%, thereby leaving 22.5% of space for non-dirty pages. The purpose of this preferred solution is to leave a certain buffer zone to avoid the extreme situation of write-back delay.

[0062] In order to measure the influence of the Linux kernel IO throttling adaptive set point control method and system proposed in the present invention on IO throttling and writing operating system performance, this embodiment implements the method in Linux kernel 5.4.x, and experiments with different settings are carried out to compare the effects. In order to eliminate the influence of the equipment, all experiments use an 8-core processor using PHYTIUM, running the Galaxy Kylin operating system V10 SP1, 8g memory and 256g Nvme hard disk. In addition, the initial settings in the system are: vm.dirty_background_ratio=20, vm.dirty_ratio=10. The FIO test tool is used for testing, and the percentile latency and throughput when performing random reads are used as observation indicators. However, when the number of dirty pages is too large, the performance overhead will also increase accordingly when the page is recycled, and it may have an adverse effect on the performance of other tasks. Therefore, while considering the adaptive set value control to improve IO performance, the risk of performance degradation of other tasks should also be prevented. This embodiment measures the performance of FIO by observing the amount of throughput. The FIO test is divided into 8 threads, and written to the corresponding files in a unified mode. In order to change the cache hit rate, the size of each file is set to 1G and 5G respectively, and the memory usage of the other workloads is kept the same size. At the same time, in order to compare the control effect of the adaptive set point control method on IO throttling, the initial hard limit ratio vm.dirty_ratio is still fixed to 60% and the extreme 100% for experiments. The experiment found that in the experiments with 1G and 5G file sizes, as the file size increases, the cache hit rate will decrease, and the advantage of increasing the set value to retain more dirty pages will also weaken. However, whether the hard limit ratio is set to 60 or 100, the FIO test has performance improvement, and when it is set to 60, the performance improvement is more obvious than when it is set to 100. In the experiment with a file size of 1G, the performance improvement is higher than when the file size is set to 5G. Observing the performance of the CPU workload, the performance of the experiment with a file size of 1G decreases less, and the performance of FIO increases more. Therefore, considering the cache hit rate can effectively improve IO performance while minimizing the performance degradation of other workloads. Experiments show that the IO throttling adaptive set point control method can achieve similar performance to manual adjustment without manually adjusting the throttling target value, which verifies the effectiveness of this method.

[0063] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0064] The above-mentioned embodiments are only preferred implementations of the present invention, and are only used to help understand the method and core ideas of the present application. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions under the idea of ​​the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A Linux kernel IO throttling adaptive set point control method, characterized in that: include: S1. Sample the percentage of dirty pages in the Linux system, and calculate the midpoint value freerun of the system's free operation according to the values ​​of the background limit ratio vm.dirty_background_ratio and the hard limit ratio vm.dirty_ratio. The midpoint value of freerun and the hard limit ratio vm.dirty_ratio is used as the setting point of the percentage of dirty pages of the I / O throttling target; if the percentage of dirty pages is greater than freerun, jump to step S2, otherwise continue sampling; S2, taking the count information of the page that is missing again after the cache page is evicted as the number of missed pages, and calculating the percentage of the number of missed pages and the number of written pages to obtain the page miss rate of the write operation; Using the difference between the page miss rate and 100% as the adaptive adjustment value of the set point; S3. If the page miss rate is less than 100%, increase the set point by the adaptive adjustment value to allow more dirty pages to remain in the memory; conversely, if the page miss rate is greater than 100%, decrease the set point by the adaptive adjustment value.

2. The Linux kernel IO throttling adaptive set point control method according to claim 1, characterized in that: Step S3 also includes: S301, presetting the adaptive adjustment period of the set point; S302, after each calculation of the adaptive adjustment value of the set point is completed, determine whether the adaptive adjustment of the set point is within the adaptive adjustment cycle, if it is within the adaptive adjustment cycle, do not perform, otherwise jump to step S303; S303, obtaining the value of the current hard limit ratio vm.dirty_ratio of the system; S304. Define the adaptive adjustment limit of the set point, and use the ratio of the remaining size after subtracting the number of currently unoccupied pages from the total number of pages in the system as the upper limit of the adaptive adjustment of the set point, and the hard limit ratio vm.dirty_ratio as the lower limit of the adaptive adjustment of the set point. After the adaptive adjustment of the set point, the set point does not exceed the range of the upper and lower limits.

3. The Linux kernel IO throttling adaptive set point control method according to claim 2, characterized in that: In step S304, if the set point exceeds the range of the upper limit or the lower limit after adaptive adjustment, the upper limit or the lower limit is used for replacement.

4. The Linux kernel IO throttling adaptive set point control method according to claim 1, characterized in that: In step S3, a margin is set, and the adjustment size of the set point is the adaptive adjustment value minus the margin.

5. A Linux kernel IO throttling adaptive set point control system, characterized in that: include: Setpoint module: samples the percentage of dirty pages in the Linux system, and calculates the midpoint value freerun of the system's free operation based on the background limit ratio vm.dirty_background_ratio and the hard limit ratio vm.dirty_ratio. The midpoint value of freerun and the hard limit ratio vm.dirty_ratio is used as the set point for the percentage of dirty pages of the I / O throttling target; if the percentage of dirty pages is greater than freerun, jump to the miss rate module, otherwise continue sampling; Miss rate module: The count information of the pages that are missing again after the cache page is evicted is taken as the number of missed pages. The page miss rate of the write operation is obtained by calculating the percentage of the number of missed pages and the number of written pages. Using the difference between the page miss rate and 100% as the adaptive adjustment value of the set point; Adjustment module: If the page miss rate is less than 100%, the set point is increased, and the increased adaptive adjustment value is the adaptive adjustment value, so that more dirty pages remain in the memory; conversely, if the page miss rate is greater than 100%, the set point is reduced, and the reduced adaptive adjustment value is the adaptive adjustment value.

6. The Linux kernel IO throttling adaptive set point control system according to claim 5, characterized in that: The adjustment module comprises: Periodic unit: presetting the adaptive adjustment period of the set point; Judgment unit: after each calculation of the adaptive adjustment value of the set point is completed, determine whether the adaptive adjustment of the set point is within the adaptive adjustment period, if it is within the adaptive adjustment period, do not execute, otherwise jump to the acquisition unit; Get unit: Get the value of the current hard limit ratio vm.dirty_ratio of the system; Boundary unit: defines the adaptive adjustment limit of the set point, and uses the ratio of the remaining size after subtracting the number of currently unoccupied pages from the total number of pages in the system as the upper limit of the adaptive adjustment of the set point, and the hard limit ratio vm.dirty_ratio as the lower limit of the adaptive adjustment of the set point. After the adaptive adjustment of the set point, the set point does not exceed the range of the upper and lower limits.

7. The Linux kernel IO throttling adaptive set point control system according to claim 6, characterized in that: In the limit unit, if the set point exceeds the range of the upper limit or the lower limit after adaptive adjustment, the upper limit or the lower limit is used for replacement.

8. The Linux kernel IO throttling adaptive set point control system according to claim 5, characterized in that: A margin is set in the adjustment module, and the adjustment size of the set point is the adaptive adjustment value minus the margin.

9. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the Linux kernel IO throttling adaptive set point control method according to any one of claims 1 to 4.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the Linux kernel IO throttling adaptive set point control method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • File system page cache writeback method, system and device and storage medium

    CN107590287A

  • Permutation and write-back adaptive buffer region management method

    CN108845957A