Write request processing method, device, equipment and medium

By identifying the write failure of the first-level private cache in the multi-core processor and obtaining the target data block through the second-level private cache, the problem of low write request hit rate in the multi-level cache storage system is solved and the performance is improved.

CN118626409BActive Publication Date: 2024-10-29BEIJING VCORE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411096641.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-10-29
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

In multi-core processors, when accessing the on-chip multi-level cache storage system, write requests may fail to hit, resulting in performance degradation. How to improve the hit rate of write requests in the multi-level cache storage system.

Method used

By obtaining the data block status in the first-level private cache, it identifies whether the write request has a write failure, and obtains the target write data block through the second-level private cache when the write fails. Different write allocation strategies are used to improve the utilization of cache storage resources.

Benefits of technology

It simplifies the identification and determination of write failures, improves the hit rate of write requests in multi-level cache storage systems, optimizes the processing method of write requests, and improves the performance of multi-core processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626409B_ABST
    Figure CN118626409B_ABST
Patent Text Reader

Abstract

The present application proposes a method, device, equipment and medium for processing a write request, which relates to the field of data processing technology. The method includes: obtaining the data block status of the first candidate data block of the first write request in the first-level private cache, wherein the first-level private cache belongs to the first processor core; according to the data block status, identifying whether the first write request is write-failed in the first-level private cache; in response to identifying that the first write request is write-failed in the first-level private cache, obtaining the target write data block of the first write request through the second-level private cache on the first processor core. The identification and determination method of write failure is simplified, the hit rate of write requests in a multi-level cache storage system is improved, and the processing method of write requests is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and medium for processing a write request. Background Art

[0002] With the development of technology, the number of processor cores integrated on a chip is increasing. When accessing the multi-level cache storage system on a chip, the access request may not hit, resulting in a decrease in the performance of the multi-core processor.

[0003] Therefore, it is very important to improve the hit rate of access requests in a multi-level cache storage system. Summary of the invention

[0004] The present application aims to solve one of the technical problems in the related art at least to some extent.

[0005] To this end, the first aspect of the present application proposes a method for processing a write request.

[0006] A second aspect of the present application provides a write request processing device.

[0007] A third aspect of the present application provides an electronic device.

[0008] A fourth aspect of the present application provides a computer-readable storage medium.

[0009] A first aspect of the present application proposes a method for processing a write request, the method comprising: obtaining a data block status of a first candidate data block of a first write request in a first-level private cache, wherein the first-level private cache belongs to a first processor core; based on the data block status, identifying whether the first write request has failed to write in the first-level private cache; in response to identifying that the first write request has failed to write in the first-level private cache, obtaining a target write data block of the first write request through the second-level private cache on the first processor core.

[0010] A second aspect of the present application proposes a write request processing device, characterized in that the device includes: a first acquisition module, used to obtain a data block status of a first candidate data block of a first write request in a first-level private cache, wherein the first-level private cache belongs to a first processor core; an identification module, used to identify whether the first write request has a write failure in the first-level private cache based on the data block status; and a second acquisition module, used to obtain a target write data block of the first write request through the second-level private cache on the first processor core in response to identifying that the first write request has a write failure in the first-level private cache.

[0011] The third aspect of the present application proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the write request processing method proposed in the first aspect is implemented.

[0012] To achieve the above-mentioned purpose, the fourth aspect of the present application proposes a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for processing a write request as proposed in the first aspect above is implemented.

[0013] The processing method, device, equipment and medium of the write request of the embodiment of the present application obtains the data block status of the first candidate data block of the first write request in the first-level private cache. When it is identified that the first write request fails to write in the first-level private cache according to the data block status, the target write data block of the first write request can be obtained through the second-level private cache corresponding to the first-level private cache. In the present application, whether the first write request fails to write in the first-level private cache is identified by the data block status, which simplifies the identification and determination method of write failure. In the scenario where the first write request fails to write in the first-level private cache, the target write data block of the first write request is obtained through the second-level private cache, which improves the hit rate of the write request in the multi-level cache storage system, optimizes the processing method of the write request, adopts different write allocation strategies for write data in different cache levels, improves the utilization rate of cache storage resources at all levels, and thus improves the performance of the multi-core processor.

[0014] It should be understood that the contents described in this application are not intended to identify the key or important features of the embodiments of this application, nor are they intended to limit the scope of this application. Other features of this application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0016] Figure 1 A flowchart of a method for processing a write request according to an embodiment of the present application;

[0017] Figure 2 A schematic diagram of a multi-level cache storage system according to an embodiment of the present application;

[0018] Figure 3 A flowchart of a method for processing a write request according to another embodiment of the present application;

[0019] Figure 4 A schematic diagram of the structure of a write request processing device according to an embodiment of the present application;

[0020] Figure 5 It is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0022] Figure 1 FIG. 1 is a flow chart of a method for processing a write request according to an embodiment of the present application. Figure 1 As shown, the method includes:

[0023] S101, obtaining a data block status of a first candidate data block in a first-level private cache for a first write request, wherein the first-level private cache belongs to a first processor core.

[0024] In the embodiment of the present application, the multi-level cache storage system may include a private cache and a shared cache. As an example, Figure 2 As shown, in Figure 2 A multi-level cache storage system is shown, including Figure 2 The first level private cache and the second level private cache on the processor core 1 are shown, and Figure 2 The shared cache is shown.

[0025] Among them, the first-level private cache and the second-level private cache on each processor core can be Figure 2 The routing nodes shown implement data interaction, and according to Figure 2 The routing nodes shown implement data coordination between caches at various levels, thereby realizing the construction of a multi-level cache storage system.

[0026] Optionally, a write request received by the multi-level cache storage system may be marked as a first write request, and a data block accessed by the first write request in a first-level private cache that receives the first write request may be marked as a first candidate data block in the first-level private cache.

[0027] In an embodiment of the present application, the first candidate data block has a corresponding state, and the state information can be marked as the data block state of the first candidate data block, wherein the data block state can be a shared state, an exclusive state, or an invalid state, which is not specifically limited here.

[0028] It should be noted that the processor core to which the first-level private cache that receives the first write request belongs may be marked as the first processor core.

[0029] As an example, Figure 2 As shown, set Figure 2The first-level private cache shown is the first-level private cache that receives the first write request, wherein the processor core to which the first-level private cache belongs is Figure 2 The processor core 1 shown, in this example, Figure 2 The processor core 1 shown may be labeled as the first processor core.

[0030] S102: Identify, based on the data block status, whether the first write request fails in the first-level private cache.

[0031] In an embodiment of the present application, for a data block that a write request wants to access in a first-level private cache, when the data block is in an exclusive state, the write request can implement a write operation on the data block, and the write request can hit the first-level private cache.

[0032] In this scenario, it is necessary to analyze the data block status of the first candidate data block to identify whether the first write request hits in the first-level private cache, wherein the miss status can be marked as a write failure status.

[0033] It can be understood that when it is identified based on the data block status that the first candidate data block is not in an exclusive state in the first-level private cache, it can be determined that the first write request does not hit in the first-level private cache, that is, in this scenario, the first write request fails to write in the first-level private cache.

[0034] S103 , in response to identifying that the first write request fails in the first-level private cache, obtaining a target write data block of the first write request through the second-level private cache on the first processor core.

[0035] In an embodiment of the present application, caches at each level in a multi-level cache storage system may not maintain an inclusive relationship (Non-Inclusive). In this scenario, a data block in the previous level cache may exist in the next level cache, or may not exist in the next level cache.

[0036] In this scenario, when the first write request fails in the first-level private cache, the second-level private cache corresponding to the first-level private cache in the multi-level cache storage system can be obtained, and the data block that can be hit by the first write request can be obtained from the caches of each level of the multi-level cache storage system through the second-level private cache step by step. This data block is the target write data block of the first write request.

[0037] It can be understood that when there is a data block in the secondary private cache that can be hit by the first write request, the data block can be determined as the target write data block of the first write request.

[0038] Furthermore, when there is no data block in the secondary private cache that can be hit by the first write request, the data block can be obtained from the shared cache or memory in the multi-level cache storage system through the secondary private cache step by step as the target write data block for the first write request.

[0039] The write request processing method proposed in the present application obtains the data block status of the first candidate data block of the first write request in the first-level private cache. When it is identified that the first write request fails to write in the first-level private cache according to the data block status, the target write data block of the first write request can be obtained through the second-level private cache corresponding to the first-level private cache. In the present application, whether the first write request fails to write in the first-level private cache is identified by the data block status, which simplifies the identification and determination method of write failure. In the scenario where the first write request fails to write in the first-level private cache, the target write data block of the first write request is obtained through the second-level private cache, which improves the hit rate of write requests in the multi-level cache storage system and optimizes the write request processing method.

[0040] In the above embodiment, the method for processing a write request can be combined with Figure 3 Further understanding, Figure 3 FIG. 1 is a flow chart of a method for processing a write request according to another embodiment of the present application. Figure 3 As shown, the method includes:

[0041] S301, identifying whether a first write request fails in a first-level private cache according to a data block status.

[0042] Optionally, in response to the data block status indicating that the first candidate data block does not exist in the first-level private cache, it is determined that the first write request is recognized as a write failure in the first-level private cache.

[0043] In the embodiment of the present application, the first candidate data block that the first write request wants to access in the first-level private cache may not exist in the first-level private cache.

[0044] In this scenario, when it is identified based on the data block status that the first candidate data block does not exist in the first-level private cache, it can be determined that the first write request does not hit in the first-level private cache, and thus it can be determined that the first write request fails in the first-level private cache.

[0045] Optionally, in response to a data block status indication that the first candidate data block is in a non-writable state in the first-level private cache, it is determined that the first write request fails to write in the first-level private cache, wherein the non-writable state includes one of a shared state and an invalid state.

[0046] In an embodiment of the present application, when a data block is in an exclusive state, it can be determined that the data block is writable. In this scenario, when it is identified based on the data block state that the first candidate data block is in an invalid state or a shared state or other non-exclusive state in the first-level private cache, it can be determined that the first candidate data block is in a non-writable state in the first-level private cache.

[0047] Further, when it is identified that the first candidate data block is in a non-writable state in the first-level private cache, it can be determined that the first write request does not hit in the first-level private cache, and thus it can be determined that the first write request fails to write in the first-level private cache.

[0048] Optionally, in response to the data block status indicating that the first candidate data block is in a non-writable state, the buffered data amount corresponding to the first write request is obtained, wherein, in response to the buffered data amount being less than a preset buffered data amount threshold, it is determined that the first write request has failed to write in the first-level private cache.

[0049] In an embodiment of the present application, a buffer corresponding to a write invalidation request exists in the first-level private cache, and the buffer can be marked as a write buffer. When the data in the write request fills up a data row in the write buffer, the data in the data row can be written into the corresponding data block.

[0050] In this scenario, when the data block status indicates that the first candidate data block is in a non-writable state, and the data of the write operation corresponding to the first write request cannot fill a data row in the write buffer, it can be determined that the first write request fails.

[0051] Among them, the data amount corresponding to the first write request can be obtained to obtain the buffer data amount required when the first write request writes the write buffer, and the upper limit value of the data buffer amount that can be provided by a data row in the write buffer can be obtained, and the upper limit value is marked as the buffer data amount threshold. In this scenario, the buffer data amount of the first write request can be compared with the buffer data amount threshold. When the buffer amount is less than the buffer data amount threshold, it can be determined that the write data corresponding to the first write request cannot fill a data row in the write buffer, and then it can be determined that the first write request has failed to write in the first-level private cache.

[0052] In response to the amount of buffered data being equal to a buffered data amount threshold, a data row write-back request for the first write request is generated and transmitted to the shared cache, so as to write the write data in the first write request in the shared cache, wherein the write data is not write-allocated in the first-level private cache and the second-level private cache on the first processor core, and is not directly written to the memory. In an embodiment of the present application, the amount of buffered data corresponding to the first write request may be equal to the buffered data amount threshold of one data row in the write buffer. In this scenario, the data carried in the first write request can be cached in one data row in the write buffer, and the data row can be written into the multi-level cache storage system.

[0053] Optionally, a write back request corresponding to the data row can be generated and marked as a data row write back request for the first write request, wherein the data row write back request can be sent directly to the shared cache of the multi-level cache storage system to write the data in the data row directly into the shared cache.

[0054] It can be understood that, by executing the data row write back request, the write data in the first write request can be directly written into the shared cache, and write allocation is not performed in the first-level private cache and the second-level private cache that receive the first write request.

[0055] In the present application, different write allocation strategies are adopted for writing data in different cache levels to improve the utilization rate of cache storage resources at each level, thereby improving the performance of the multi-core processor.

[0056] Optionally, in response to the cache directory receiving the data line write back request transmitted by the second-level private cache and the write data in the first write request being written to the shared cache, the cache directory returns a data line write back response to the second-level private cache.

[0057] In an embodiment of the present application, when processing a data row write back request corresponding to a first write request, the multi-level cache storage system will also transmit the corresponding data row request to the cache directory to achieve data consistency maintenance for the multi-level cache storage system.

[0058] Optionally, a corresponding data row write-back request may be sent to the cache directory through a second-level private cache corresponding to a first-level private cache corresponding to the first write request.

[0059] In this scenario, the write data in the first write request can be directly written back to the shared cache. The cache directory can return corresponding response information to the secondary private cache after the write data in the first write request is written to the shared cache. The response information can be marked as the data row write back response corresponding to the data row write back request.

[0060] Optionally, in response to the data block status indicating that the first candidate data block is in an exclusive state, the first candidate data block is determined to be in a writable state, and it is determined that the first write request hits in the first-level private cache, and the first candidate data block is used as the target write data block of the first write request.

[0061] In an embodiment of the present application, when the state of a data block accessed by any write request in the first-level private cache is in an exclusive state, the data block can realize the writing of the write data carried in the write request, wherein the exclusive state can be understood as a writable state.

[0062] In this scenario, when the data block status indicates that the first candidate data block is in an exclusive state, it can be determined that the first candidate data block is in a writable state, and further it can be determined that the first write request hits in the first-level private cache.

[0063] Further, the first candidate data block hit by the first write request may be determined as the target write data block of the first write request.

[0064] S302: In response to identifying that a first write request fails in the first-level private cache, a target write data block of the first write request is obtained through the second-level private cache on the first processor core.

[0065] Optionally, in response to a write failure of the first write request in the first-level private cache, a second write request is generated.

[0066] In an embodiment of the present application, when a first write request fails in a first-level private cache, a corresponding write request can be generated and transmitted to a second-level private cache corresponding to the first-level private cache, thereby achieving the purpose of obtaining a target write data block through the second-level private cache.

[0067] The write request transmitted to the secondary private cache may be marked as a second write request corresponding to the first write request.

[0068] Optionally, it is identified whether the second write request hits in the secondary private cache.

[0069] In which, in response to the second candidate data block of the second write request in the secondary private cache being in a non-writable state, it is determined that the second write request misses in the secondary private cache, wherein the non-writable state includes one of a shared state and an invalid state.

[0070] In the present application, the data block accessed by the second write request in the secondary private cache can be marked as a second candidate data block. When the second candidate data block is in a non-writable state such as a shared state or an invalid state, it can be determined that the second candidate data block cannot realize the writing of the data corresponding to the second write request.

[0071] Further, it can be determined that the second write request does not hit in the L2 private cache.

[0072] Optionally, in response to the second candidate data block of the second write request not existing in the secondary private cache, it is determined that the second write request does not hit in the secondary private cache.

[0073] In an embodiment of the present application, the second candidate data block accessed by the second write request in the secondary private cache may not exist in the secondary private cache. In this case, it can be determined that the second write request in this scenario does not hit the secondary private cache.

[0074] Optionally, in response to the second candidate data block corresponding to the second write request being in an exclusive state, determining that the second candidate data block is in a writable state, and determining that the first write request hits in the secondary private cache, the second candidate data block is used as the target write data block of the first write request.

[0075] In the embodiment of the present application, when the second candidate data block is in an exclusive state, it can be determined that the second candidate data block is in a writable state, and the data in the second write request can be written into the second candidate data block.

[0076] In this scenario, it can be determined that the second write request hits in the secondary private cache, which can be understood as the first write request hits in the secondary private cache. Further, the second candidate data block in the secondary private cache can be used as the target write data block of the first write request.

[0077] Optionally, in response to identifying that the second write request does not hit in the L2 private cache, a third write request is generated.

[0078] In the embodiment of the present application, when the second write request does not hit in the secondary private cache, the target write data block of the first write request can be obtained from the shared cache or the memory through the secondary private cache.

[0079] The write request generated by the secondary private cache based on the second write request may be marked as a third write request. It should be noted that the third write request may be sent to a shared cache or to a cache directory of a multi-level cache storage system, which is not specifically limited here.

[0080] Optionally, a target write data block of the first write request is obtained according to the third write request.

[0081] Among them, the third write request can be transmitted to the cache directory. In this scenario, the directory information of the third write request in the cache directory of the multi-level cache storage system can be obtained, and the target write data block of the first write request can be obtained based on the directory information.

[0082] In an embodiment of the present application, the request information carried in the third write request can be obtained, and the request information can be compared with the information stored in the cache directory of the multi-level cache storage system. The information associated with the request information can be filtered out from all the information through the comparison results as the directory information of the third write request in the cache.

[0083] Optionally, in response to the directory information indicating that the third candidate data block corresponding to the third write request is in a valid and clean state, the third candidate data block is obtained from the second processor core as the target write data block, and the third candidate data block on the second processor core is invalidated, wherein the second processor core is a processor core that has a backup of the third candidate data block among the remaining processor cores except the first processor core.

[0084] In an embodiment of the present application, the directory information associated with the third write request in the cache directory has an associated data block in the multi-level cache storage system, and the data block can be marked as a third candidate data block corresponding to the third write request.

[0085] In this scenario, relevant information of the third candidate data block can be obtained through the directory information, wherein when the directory information indicates that the third candidate data block is in a valid and clean state (valid-clean), the third candidate data block can be used as the target write data block of the first write request.

[0086] The processor core currently storing the third candidate data block and the processing core of the backup data block for the third candidate data block in the multi-level cache storage system may be marked as the second processor core.

[0087] In order to make the third candidate data block serve as the target write data block of the first write request, when the third candidate data block is transmitted to the first processing core, it is necessary to invalidate the third candidate data blocks on all the second processor cores so that the third candidate data block on the first processor core can be the exclusive data block of the first processing core.

[0088] Optionally, the invalidation of the third candidate data block on the second processor core may be understood in conjunction with the following contents:

[0089] In some implementations, in response to the third candidate data block being in a shared state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, after the third candidate data block in the first-level private cache on the second processor core is invalidated, the third candidate data block in the second-level private cache on the second processor core is invalidated.

[0090] In an embodiment of the present application, for any second processor core, when the third candidate data block on the second processor core is in a shared state in the second-level private cache on the second processor core, and the third candidate data block exists in the first-level private cache on the second processor core, the third candidate data block in the first-level private cache can be invalidated, and then the third candidate data block in the second-level private cache on the second processor core can be invalidated.

[0091] In some other implementations, in response to the third candidate data block being in a shared state in the secondary private cache on the second processor core and the third candidate data block not existing in the primary private cache on the second processor core, the third candidate data block in the secondary private cache on the second processor core is invalidated.

[0092] In an embodiment of the present application, for any second processor core, when the third candidate data block in the second-level private cache on the second processor core is in a shared state and the third candidate data block does not exist in the first-level private cache on the second processor core, the third candidate data block in the second-level private cache on the second processor core can be directly invalidated.

[0093] It should be noted that the data block state of the third candidate data block on the second processor core can be adjusted to an invalid state according to the data block state adjustment method in the relevant technology to achieve invalid processing of the third candidate data block, or the invalid processing of the third candidate data block can be achieved according to other data block invalid processing methods, which is not specifically limited here.

[0094] Optionally, in response to the directory information indicating that the third candidate data block is in a valid dirty state, the third candidate data block is obtained from the second processor core as a target write data block, and the third candidate data block on the second processor core is invalidated and written back, wherein the second processor core is a processor core that exclusively owns a backup of the third candidate data block among the remaining processor cores except the first processor core, or is a processor core to which the owner node of the third candidate data block belongs.

[0095] In the embodiment of the present application, when the specific information in the directory information records that the third candidate data block is in a valid-dirty state, it can be determined that the data in the third candidate data block needs to be written back.

[0096] In this scenario, the processor core can exclusively own the third candidate data block or serve as the owner node of the third candidate data block, wherein the processor core that exclusively owns the third candidate data block or the processor core that serves as the owner node of the third candidate data block can be marked as the second processor core.

[0097] Optionally, the third candidate data block on the second processor core may be used as the target write data block of the first write request, and the third candidate data block on the second processor core may be invalidated and written back.

[0098] It can be understood that in order to make the third candidate data block serve as an exclusive data block on the first processing core, when the first processor core obtains the third candidate data block, it is necessary to invalidate the third candidate data block on the second processor core. Since the third candidate data block is in a valid dirty state, the data in the third candidate data block needs to be written back.

[0099] The invalidation and write-back processing of the third candidate data block can be understood in conjunction with the following contents:

[0100] Optionally, in response to the third candidate data block being in an exclusive state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, after the third candidate data block in the first-level private cache on the second processor core is invalidated and written back to the second-level private cache on the second processor core, the third candidate data block in the second-level private cache on the second processor core is invalidated, a write-back response is sent to the cache directory, and the third candidate data block is written back.

[0101] In an embodiment of the present application, when the third candidate data block exists in the first-level private cache on the second processor core and is in an exclusive state in the second-level private cache on the second processor core, the third candidate data block in the first-level private cache can be invalidated and written back.

[0102] Among them, based on the execution of the invalidate and write back instruction, the data stored in the third candidate data block in the first-level private cache can be written back to the third candidate data block in the second-level private cache on the second processor core, and then the third candidate data block in the second-level private cache can be written back and invalidated, thereby realizing the invalidation and write back processing of the third candidate data block on the second processor core.

[0103] It should be noted that the second processor core can send a write-back response to the cache directory. After receiving the write-back response from the second processor core, the cache directory can send a corresponding write-back response to the secondary private cache that sent the third write request, so as to use the third candidate data block as the target write data block of the first write request.

[0104] Optionally, in response to the directory information being empty or the directory information indicating that the third candidate data block is invalid, a target write data block corresponding to the third write request is obtained from the shared cache and / or the memory.

[0105] In the embodiment of the present application, the corresponding target information of the third write request may not exist in the cache directory, and this scenario can be marked as the directory information of the third write request in the cache directory is empty.

[0106] Furthermore, when the directory information exists in the cache directory for the third write request, the state of the data block stored in the directory information may be in an invalid state.

[0107] In these two scenarios, it can be determined that the target write data block cannot be acquired through the cache directory. In this scenario, the target write data block needs to be acquired through the shared cache and / or memory in the multi-level cache storage system.

[0108] As a possible implementation manner, the secondary private cache may send the third write request to the memory, wherein a fourth candidate data block of the third write request in the memory may be obtained, and the fourth candidate data block may be determined as the target write data block.

[0109] In an embodiment of the present application, the data block accessed by the third write request in the memory may be marked as a fourth candidate data block, and the fourth candidate data block may be used as the target write data block of the first write request in the multi-level cache storage system.

[0110] It should be noted that writing the target write data block only to the secondary private cache can be understood as, in the scenario where the target write data block is only written to the secondary private cache that sends the third write request, the target write data block is the exclusive data block of the secondary private cache. In this scenario, the second write request can hit in the secondary private cache, that is, the first write request corresponding to the second write request can hit in the first private cache corresponding to the secondary private cache.

[0111] Further, the target write data block is the target write data block of the first write request.

[0112] The write request processing method proposed in the present application obtains the data block status of the first candidate data block of the first write request in the first-level private cache. When it is identified that the first write request fails to write in the first-level private cache according to the data block status, the target write data block of the first write request can be obtained through the second-level private cache corresponding to the first-level private cache. In the present application, whether the first write request fails to write in the first-level private cache is identified by the data block status, which simplifies the identification and determination method of write failure. In the scenario where the first write request fails to write in the first-level private cache, the target write data block of the first write request is obtained through the second-level private cache, which improves the hit rate of write requests in the multi-level cache storage system, optimizes the processing method of write requests, adopts different write allocation strategies for write data in different cache levels, improves the utilization rate of cache storage resources at all levels, and thus improves the performance of multi-core processors.

[0113] Corresponding to the write request processing methods proposed in the above-mentioned embodiments, an embodiment of the present application further proposes a write request processing device. Since the write request processing device proposed in the embodiment of the present application corresponds to the write request processing methods proposed in the above-mentioned embodiments, the implementation method of the above-mentioned write request processing method is also applicable to the write request processing device proposed in the embodiment of the present application, and will not be described in detail in the following embodiments.

[0114] Figure 4 FIG. 1 is a schematic diagram of a structure of a write request processing device according to an embodiment of the present application. Figure 4As shown, the write request processing device 400 includes a first acquisition module 41, an identification module 42 and a second acquisition module 43, wherein:

[0115] A first acquisition module 41 is used to acquire a data block status of a first candidate data block in a first-level private cache for a first write request, wherein the first-level private cache belongs to a first processor core;

[0116] An identification module 42, configured to identify whether the first write request fails to write in the first-level private cache according to the data block status;

[0117] The second acquisition module 43 is configured to acquire a target write data block of the first write request through the second-level private cache on the first processor core in response to identifying that the first write request fails in the first-level private cache.

[0118] In the embodiment of the present application, the identification module 42 is also used to: in response to the data block status indicating that the first candidate data block does not exist in the first-level private cache, determine that the first write request is identified as failing to write in the first-level private cache; in response to the data block status indicating that the first candidate data block is in a non-writable state in the first-level private cache, determine that the first write request is identified as failing to write in the first-level private cache, wherein the non-writable state includes one of a shared state and an invalid state.

[0119] In an embodiment of the present application, the identification module 42 is also used to: in response to the data block status indicating that the first candidate data block is in a non-writable state, obtain the buffered data volume corresponding to the first write request; in response to the buffered data volume being less than a preset buffered data volume threshold, determine that the first write request has failed to write in the first-level private cache.

[0120] In an embodiment of the present application, the second acquisition module 43 is also used to: generate a second write request in response to a write failure of the first write request in the first-level private cache; identify whether the second write request hits in the second-level private cache; generate a third write request in response to identifying that the second write request does not hit in the second-level private cache; and obtain the target write data block of the first write request according to the third write request.

[0121] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the second candidate data block of the second write request in the secondary private cache being in a non-writable state, determine and identify that the second write request has not hit the secondary private cache, wherein the non-writable state includes one of a shared state and an invalid state; in response to the second candidate data block of the second write request in the secondary private cache not existing, determine and identify that the second write request has not hit the secondary private cache.

[0122] In the embodiment of the present application, the second acquisition module 43 is further used to: obtain directory information of the third write request in the cache directory of the multi-level cache storage system; and obtain the target write data block of the first write request according to the directory information.

[0123] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the directory information indicating that the third candidate data block corresponding to the third write request is in a valid and clean state, obtain the third candidate data block from the second processor core as the target write data block, and invalidate the third candidate data block on the second processor core, wherein the second processor core is a processor core that has a backup of the third candidate data block among the remaining processor cores other than the first processor core; in response to the directory information indicating that the third candidate data block is in a valid dirty state, obtain the third candidate data block from the second processor core as the target write data block, and invalidate and write back the third candidate data block on the second processor core, wherein the second processor core is a processor core that monopolizes the backup of the third candidate data block among the remaining processor cores other than the first processor core, or is a processor core to which the owner node of the third candidate data block belongs; in response to the directory information being empty or the directory information indicating that the third candidate data block is invalid, obtain the target write data block corresponding to the third write request from the shared cache and / or memory.

[0124] In the embodiment of the present application, the second acquisition module 43 is further used to: acquire a fourth candidate data block in the memory of the third write request, and determine the fourth candidate data block as the target write data block.

[0125] In the embodiment of the present application, the second acquisition module 43 is further used to: write the target write data block only into the secondary private cache.

[0126] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the third candidate data block being in a shared state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, invalidate the third candidate data block in the first-level private cache on the second processor core, and then invalidate the third candidate data block in the second-level private cache on the second processor core; in response to the third candidate data block being in a shared state in the second-level private cache on the second processor core, and the third candidate data block not existing in the first-level private cache on the second processor core, invalidate the third candidate data block in the second-level private cache on the second processor core.

[0127] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the third candidate data block being in an exclusive state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, invalidate the third candidate data block in the first-level private cache on the second processor core and write it back to the second-level private cache on the second processor core, invalidate the third candidate data block in the second-level private cache on the second processor core, send a write-back response to the cache directory, and write the third candidate data block back.

[0128] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the buffered data amount being equal to the buffered data amount threshold, generate a data row write back request for the first write request and transmit it to the shared cache, so as to write the write data in the first write request in the shared cache, wherein the write data is not write allocated in the first-level private cache and the second-level private cache on the first processor core, and is not directly written to the memory.

[0129] In the embodiment of the present application, the second acquisition module 43 is also used for: in response to the cache directory receiving a data row write back request transmitted by the secondary private cache and the write data in the first write request being written to the shared cache, the cache directory returns a data row write back response to the secondary private cache.

[0130] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the data block status indicating that the first candidate data block is in an exclusive state, determine that the first candidate data block is in a writable state, and determine that the first write request hits in the first-level private cache; use the first candidate data block as the target write data block for the first write request.

[0131] In an embodiment of the present application, the second acquisition module 43 is also used to: in response to the second candidate data block corresponding to the second write request being in an exclusive state, determine that the second candidate data block is in a writable state, and determine that the first write request hits in the secondary private cache; use the second candidate data block as the target write data block for the first write request.

[0132] The write request processing device proposed in the present application obtains the data block status of the first candidate data block of the first write request in the first-level private cache. When it is identified that the first write request fails to write in the first-level private cache according to the data block status, the target write data block of the first write request can be obtained through the second-level private cache corresponding to the first-level private cache. In the present application, whether the first write request fails to write in the first-level private cache is identified by the data block status, which simplifies the identification and determination method of write failure. In the scenario where the first write request fails to write in the first-level private cache, the target write data block of the first write request is obtained through the second-level private cache, which improves the hit rate of write requests in the multi-level cache storage system, optimizes the processing method of write requests, adopts different write allocation strategies for write data in different cache levels, improves the utilization rate of cache storage resources at all levels, and thus improves the performance of multi-core processors.

[0133] In order to implement the above embodiment, the present application embodiment also proposes an electronic device 500, such as Figure 5 As shown, the electronic device 500 may specifically include: a memory 51, a processor 52, and a computer program stored in the memory 51 and executable on the processor 52. When the processor 52 executes the program, the write request processing method shown in the above embodiment is implemented.

[0134] In order to implement the above embodiment, the embodiment of the present application further proposes a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement the method for processing a write request as shown in the above embodiment.

[0135] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0136] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0137] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A method for processing a write request, characterized in that: The method comprises: Obtaining a data block status of a first candidate data block in a first-level private cache for a first write request, wherein the first-level private cache belongs to a first processor core; According to the data block state, identifying whether the first write request fails to write in the first-level private cache; In response to identifying that the first write request fails to write in the first-level private cache, acquiring a target write data block of the first write request through the second-level private cache on the first processor core; According to the data block status, identifying whether the first write request fails to write in the first-level private cache includes: in response to the data block status indicating that the first candidate data block does not exist in the first-level private cache, determining that the first write request fails to write in the first-level private cache; in response to the data block status indicating that the first candidate data block is in a non-writable state in the first-level private cache, determining that the first write request fails to write in the first-level private cache, wherein the non-writable state includes one of a shared state and an invalid state; In response to identifying that the first write request fails to write in the first-level private cache, obtaining the target write data block of the first write request through the second-level private cache on the first processor core, including: generating a second write request in response to the first write request failing to write in the first-level private cache; determining that the second write request does not hit in the second-level private cache in response to the second write request that the second candidate data block in the second-level private cache is in a non-writable state, and determining that the second write request does not hit in the second-level private cache in response to the second write request that the second candidate data block in the second-level private cache does not exist; generating a third write request in response to identifying that the second write request does not hit in the second-level private cache; and obtaining the target write data block of the first write request according to the third write request.

2. The method according to claim 1, characterized in that: The method further comprises: In response to the data block status indicating that the first candidate data block is in the non-writable state, obtaining a buffered data amount corresponding to the first write request; In response to the buffered data amount being less than a preset buffered data amount threshold, it is determined that the first write request fails to be written in the first-level private cache.

3. The method according to claim 1, characterized in that The step of obtaining the target write data block of the first write request according to the third write request includes: Obtaining directory information of the third write request in a cache directory of the multi-level cache storage system; The target write data block of the first write request is obtained according to the directory information.

4. The method according to claim 3, characterized in that The acquiring, according to the directory information, the target write data block of the first write request includes: In response to the directory information indicating that the third candidate data block corresponding to the third write request is in a valid and clean state, obtaining the third candidate data block from a second processor core as the target write data block, and performing invalid processing on the third candidate data block on the second processor core, wherein the second processor core is a processor core that has a backup of the third candidate data block among the remaining processor cores except the first processor core; In response to the directory information indicating that the third candidate data block is in a valid dirty state, obtaining the third candidate data block from the second processor core as the target write data block, and performing invalidation and write-back processing on the third candidate data block on the second processor core, wherein the second processor core is a processor core that exclusively owns a backup of the third candidate data block among the remaining processor cores except the first processor core, or is a processor core to which an owner node of the third candidate data block belongs; In response to the directory information being empty or the directory information indicating that the third candidate data block is invalid, the target write data block corresponding to the third write request is acquired from a shared cache and / or a memory.

5. The method according to claim 3, characterized in that: The step of obtaining the target write data block of the first write request according to the third write request includes: A fourth candidate data block of the third write request in the memory is obtained, and the fourth candidate data block is determined as the target write data block.

6. The method according to claim 5, characterized in that After obtaining the fourth candidate data block of the third write request in the memory and determining the fourth candidate data block as the target write data block, the method includes: The target write data block is written only into the secondary private cache.

7. The method according to claim 4, characterized in that The performing invalid processing on the third candidate data block on the second processor core includes: In response to the third candidate data block being in a shared state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, after invalidating the third candidate data block in the first-level private cache on the second processor core, invalidate the third candidate data block in the second-level private cache on the second processor core; In response to the third candidate data block being in a shared state in the secondary private cache on the second processor core and the third candidate data block not existing in the primary private cache on the second processor core, the third candidate data block in the secondary private cache on the second processor core is invalidated.

8. The method according to claim 4, characterized in that The invalidating and writing back the third candidate data block on the second processor core comprises: In response to the third candidate data block being in an exclusive state in the second-level private cache on the second processor core, and the third candidate data block existing in the first-level private cache on the second processor core, after the third candidate data block in the first-level private cache on the second processor core is invalidated and written back to the second-level private cache on the second processor core, the third candidate data block in the second-level private cache on the second processor core is invalidated, a write-back response is sent to the cache directory, and the third candidate data block is written back.

9. The method according to claim 2, characterized in that: The method further comprises: In response to the buffered data amount being equal to the buffered data amount threshold, a data row write back request for the first write request is generated and transmitted to the shared cache, so as to write the write data in the first write request in the shared cache, wherein the write data is not write allocated in the first-level private cache and the second-level private cache on the first processor core, and is not directly written to the memory.

10. The method according to claim 9, characterized in that The method further comprises: In response to the cache directory receiving the data line write back request transmitted by the second-level private cache and the write data in the first write request being written into the shared cache, the cache directory returns a data line write back response to the second-level private cache.

11. The method according to claim 1, characterized in that: The method further comprises: In response to the data block status indicating that the first candidate data block is in an exclusive state, determining that the first candidate data block is in a writable state, and determining that the first write request hits in the first-level private cache; The first candidate data block is used as the target write data block of the first write request.

12. The method according to claim 1, characterized in that The method further comprises: In response to the second candidate data block corresponding to the second write request being in an exclusive state, determining that the second candidate data block is in a writable state, and determining that the first write request hits in the secondary private cache; The second candidate data block is used as the target write data block of the first write request.

13. A write request processing device, characterized in that: The device comprises: A first acquisition module, configured to acquire a data block status of a first candidate data block in a first-level private cache for a first write request, wherein the first-level private cache belongs to a first processor core; an identification module, configured to identify whether the first write request fails to write in the first-level private cache according to the data block state; A second acquisition module, configured to, in response to identifying that the first write request fails to write in the first-level private cache, acquire a target write data block of the first write request through the second-level private cache on the first processor core; According to the data block status, identifying whether the first write request fails to write in the first-level private cache includes: in response to the data block status indicating that the first candidate data block does not exist in the first-level private cache, determining that the first write request fails to write in the first-level private cache; in response to the data block status indicating that the first candidate data block is in a non-writable state in the first-level private cache, determining that the first write request fails to write in the first-level private cache, wherein the non-writable state includes one of a shared state and an invalid state; In response to identifying that the first write request fails to write in the first-level private cache, obtaining the target write data block of the first write request through the second-level private cache on the first processor core, including: generating a second write request in response to the first write request failing to write in the first-level private cache; determining that the second write request does not hit in the second-level private cache in response to the second write request that the second candidate data block in the second-level private cache is in a non-writable state, and determining that the second write request does not hit in the second-level private cache in response to the second write request that the second candidate data block in the second-level private cache does not exist; generating a third write request in response to identifying that the second write request does not hit in the second-level private cache; and obtaining the target write data block of the first write request according to the third write request.

14. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 12 is implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Method for realizing cache coherence protocol of chip multiprocessor (CMP) system

    CN102103568A

  • Access method and device of multi-level cache system, electronic equipment and storage medium

    CN117971720A