Read-write permission management method for shared memory, and controller and memory expander device

Managing shared memory permissions through atomic operations within the CXL memory expansion device solves CPU consumption and reliability issues caused by software management, improves server performance and reduces costs.

WO2025200438A1PCT designated stage Publication Date: 2025-10-02XFUSION DIGITAL TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/128841
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-29
Filing Date
2024-10-31
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In current technology, managing shared memory read and write permissions through additional software increases server CPU computing power consumption, degrades performance, increases deployment costs, and causes reliability issues when managers fail or crash.

Method used

The CXL memory expansion device is used to implement read and write permission management for shared memory, and CAS and FAA atomic operations are used to allocate and reclaim permissions within the device, avoiding the introduction of additional administrators.

Benefits of technology

It improves server performance, reduces deployment costs, avoids reliability issues caused by administrator failures, and reduces CPU computing power consumption and network interaction delays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024128841_02102025_PF_FP_ABST
    Figure CN2024128841_02102025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a read-write permission management method for a shared memory, and a controller and a memory expander device. The method is applied to a compute express link (CXL) memory expander device. The method comprises: on the basis of a write-permission acquisition request for a shared memory that is sent by a server, reading first data from the shared memory; and when first comparison data is the same as the first data, modifying the first data into first swap data, so as to realize the allocation of a write permission of the shared memory. The CXL memory expander device manages the read-write permission of a shared memory without requiring additional administrators, thus preventing CPU computing power from being consumed by a server running the administrators, improving the performance of the server, and reducing deployment costs.
Need to check novelty before this filing date? Find Prior Art

Description

Shared memory read and write permission management method, controller and memory expansion device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 29, 2024, with application number 202410389563.8 and application name “Read and write permission management method, controller and memory expansion device for shared memory”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a method for managing read and write permissions of a shared memory, a controller, and a memory expansion device. Background Art

[0003] Compute Express Link (CXL) is an interconnect technology designed for memory expansion, heterogeneous computing, and computer resource disaggregation. It allows efficient data exchange and communication between multiple hosts or devices through shared memory. When multiple server applications share the same shared memory (shared memory) on a CXL memory expansion device, the server applications ensure data consistency and reliability by requesting read or write permissions to the shared memory.

[0004] In current technology, additional software is usually introduced as a manager of shared memory read and write permissions, that is, the management of shared memory read and write permissions is completed through additional software. The manager can run in any server node among multiple server nodes corresponding to the same shared memory.

[0005] It can be seen from this that the current technology introduces additional software as a manager of the read and write permissions of the shared memory, resulting in additional consumption of the server's CPU computing power, causing server performance to degrade and increasing deployment costs.

[0006] Summary of the Invention

[0007] The shared memory read and write permission management method, controller, and memory expansion device provided in the embodiments of the present application avoid the additional consumption of the server's CPU computing power caused by the introduction of additional software, improve the performance of the server, and reduce deployment costs.

[0008] To achieve the above objectives, the present invention adopts the following technical solutions:

[0009] In the first aspect, an embodiment of the present application provides a method for managing read and write permissions of a shared memory, which is applied to a computing high-speed interconnect link CXL memory expansion device, the method comprising: receiving a write permission acquisition request for the shared memory sent by the server, the write permission acquisition request carrying first comparison data and first exchange data; in response to receipt of the write permission acquisition request, reading the first data in the shared memory, the first data being data stored in the first area in the metaspace of the shared memory, and being used to indicate the allocation of write permissions of the shared memory; when the first comparison data is the same as the first data, modifying the first data in the shared memory to the first exchange data to allocate the write permissions of the shared memory to the server.

[0010] In the embodiments of the present application, the CXL memory expansion device can allocate write permissions to shared memory without requiring an additional administrator. This avoids the CPU consumption of the server caused by running an administrator, improves server performance, and reduces deployment costs. Furthermore, since no additional administrator is required, the reliability issue of being unable to access shared memory due to a failure or crash of the administrator during operation is avoided.

[0011] In one possible implementation, after modifying the first data stored in the shared memory into the first exchange data, the CXL memory expansion device returns the original first data to the server. The server determines, based on the original first data, that the write permission to the shared memory has been successfully acquired. The original first data is the first comparison data, i.e., the original first data indicates that the write permission to the shared memory is allocated as unallocated. The server determines, based on the original first data, that the write permission to the shared memory has been successfully acquired, allowing the server to perform a write operation on the shared memory.

[0012] In one possible implementation, a write permission release request for a shared memory is received from a server, the write permission release request carrying second comparison data and second exchange data, the second comparison data being the first exchange data and the second exchange data being the first comparison data; in response to receiving the write permission release request, the first data in the shared memory is read, the first data being the first exchange data; in response to the first data being the same as the second comparison data, the first data in the shared memory is modified to the second exchange data to reclaim the write permission for the shared memory. After completing the write operation, the server will promptly release the write permission for the shared memory so that other servers can apply for the write permission for the shared memory. In an embodiment of the present application, the CXL memory expansion device can also reclaim the write permission for the shared memory, that is, manage the write permission for the shared memory without the need for an additional administrator, thereby avoiding the consumption of CPU computing power caused by the server running the administrator, improving the performance of the server, and reducing the deployment cost. Furthermore, since no additional administrator is required, the reliability problem of being unable to access the shared memory due to a failure or crash of the administrator during operation is avoided.

[0013] In one possible implementation, after modifying first data in the shared memory to second exchange data, the CXL memory expansion device receives a read request for the first data in the shared memory from a server. In response to the read request for the first data, the CXL memory expansion device returns the first data to the server. Based on the first data, the server determines that the write permission to the shared memory has been successfully released. Specifically, if the server determines that the first data is the first comparison data, indicating that the current allocation of the write permission to the shared memory is unallocated, the server determines that the write permission to the shared memory has been successfully released.

[0014] In one possible implementation, when the first comparison data is different from the first data, the first data in the shared memory is not modified and the first data is returned to the server. The server determines whether to obtain write permission for the shared memory based on the first data. That is, when the first data is not the first comparison data, it indicates that the allocation of the write permission for the shared memory is allocated, so the server cannot obtain the write permission for the shared memory, and returns the first data to inform the server that the acquisition of the write permission for the shared memory has failed.

[0015] In a possible implementation, the first exchange data carried in the write permission acquisition request is used to indicate the unique identifier of the sender of the write permission acquisition request, and the first exchange data includes one or more of the following: the unique identifier of the server, the unique identifier of the current process.

[0016] In a second aspect, an embodiment of the present application provides a method for managing read and write permissions for a shared memory, which is applied to a computing high-speed interconnect link CXL memory expansion device. The method includes: receiving a read permission acquisition request for the shared memory sent by a server; the read permission acquisition request carries a first incremented data, the first incremented data being 1; in response to receiving the read permission acquisition request, reading second data in the shared memory, the second data being data stored in a second area of ​​the shared memory metaspace, used to indicate the allocation of read permissions for the shared memory; adding the second data to the first incremented data to obtain a first addition result, and modifying the second data stored in the shared memory to the first addition result to allocate read permissions for the shared memory to the server. In an embodiment of the present application, the CXL memory expansion device can update the shared memory read permission allocation request based on the server's read permission acquisition request for the shared memory, thereby completing the allocation of read permissions. That is, the CXL memory expansion device can allocate read permissions for the shared memory without the need for an additional administrator, thus avoiding the consumption of CPU computing power caused by the server running the administrator, improving the server's performance, and reducing deployment costs. Furthermore, since there is no need to introduce an additional manager, the reliability problem of being unable to access the shared memory due to a failure or crash of the manager during operation is avoided.

[0017] In one possible implementation, after the CXL memory expansion device modifies the second data in the shared memory to the first addition result, it returns the original second data to the server to notify the server that it has successfully obtained the read permission for the shared memory, so that the server can subsequently perform a read operation on the shared memory.

[0018] In one possible implementation, a read permission release request for a shared memory is received from a server; the read permission release request carries a second incremental data, which is -1; in response to the reception of the read permission release request, the second data in the shared memory is read; the second data is added to the second incremental data to obtain a second addition result, and the second data in the shared memory is modified to the second addition result to reclaim the read permission of the shared memory. After completing the read operation, the server will promptly release the read permission of the shared memory to avoid security risks caused by excessive permissions, and to avoid other users or processes accidentally changing or destroying data with this permission. In addition, the CXL memory expansion device can also reclaim the read permission of the shared memory, that is, to manage the read permission of the shared memory without the need for an additional administrator, thus avoiding the consumption of CPU computing power caused by the server running the administrator, improving the performance of the server, and reducing the deployment cost.

[0019] In a possible implementation, after modifying the second data in the shared memory into the second addition result, the CXL memory expansion device returns the original second data to the server to prompt the server that the read permission of the shared memory is released successfully.

[0020] In a third aspect, an embodiment of the present application provides a computing high-speed interconnect link CXL controller that executes the method described in the first aspect or the second aspect.

[0021] In a fourth aspect, an embodiment of the present application provides a computing high-speed interconnect link CXL memory expansion device, comprising the CXL controller as described in the third aspect, and a memory connected to the CXL controller; the memory includes a shared memory, and the CXL controller is used to execute the method as described in the first aspect or the second aspect.

[0022] In a fifth aspect, an embodiment of the present application provides a server comprising a processor and a memory; the processor is coupled to the memory, and the memory stores computer program instructions. When the computer program instructions are processed and executed, a write permission acquisition request, a write permission release request, a read permission acquisition request, or a read permission release request is sent to the CXL memory expansion device. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] FIG1 is a schematic diagram of the structure of a shared memory read-write permission management system in the current technology;

[0024] FIG2 is a schematic diagram of an application scenario of a single-port CXL memory expansion device provided in an embodiment of the present application;

[0025] FIG3 is a schematic diagram of an application scenario of a dual-port CXL memory expansion device provided in an embodiment of the present application;

[0026] FIG4 is a schematic diagram of the structure of a shared memory read and write permission management system provided in an embodiment of the present application;

[0027] FIG5A is a flow chart of a method for allocating write permissions to a shared memory provided in an embodiment of the present application;

[0028] FIG5B is a flow chart of another method for allocating write permissions to a shared memory provided in an embodiment of the present application;

[0029] FIG6 is a schematic diagram of the structure of a shared data area provided in an embodiment of the present application;

[0030] FIG7 is a schematic diagram of code for implementing a CAS atomic operation in a CXL memory expansion device 430 according to an embodiment of the present application;

[0031] FIG8 is a flow chart of a method for reclaiming write permissions of a shared memory provided in an embodiment of the present application;

[0032] FIG9 is a flow chart of a method for allocating read permissions to a shared memory provided in an embodiment of the present application;

[0033] FIG10 is a flow chart of a method for reclaiming read permissions of a shared memory provided in an embodiment of the present application;

[0034] FIG11 is a schematic structural diagram of a shared memory read and write permission management device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The terms "first", "second" and "third" in the description of the embodiments of the present application, the claims and the description of the drawings are used to distinguish different objects, rather than to limit a specific order.

[0036] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0037] To make the description of the following embodiments clear and concise, a brief introduction to the related technologies is first given:

[0038] Computational Power refers to the ability of a device to perform numerical calculations and processing tasks. Simply put, computing power determines the speed and efficiency of the device in processing information.

[0039] CPU computing power refers to the ability of a central processing unit (CPU) to perform numerical calculations and processing tasks. Generally, CPU computing power is measured by metrics such as clock frequency, number of processor cores, and cache size.

[0040] CXL memory expansion devices typically carry large amounts of expanded memory. This expanded memory can be used in conjunction with the server's existing memory to significantly improve system performance while reducing software stack complexity and data center total cost of ownership. The expanded memory carried by one or more CXL memory expansion devices forms a memory pool.

[0041] A memory pool can be thought of as a buffer containing a certain number of memory blocks. These blocks can be allocated and deallocated as needed to meet the memory needs of the program during execution. The main advantage of a memory pool is that it avoids the performance overhead caused by frequent memory allocation and deallocation.

[0042] An atomic operation is an operation that will not be interrupted by the thread scheduling mechanism. Once an atomic operation starts, it will run until it ends without switching to another thread (context switch).

[0043] The advantages of a shared memory read and write permission management method provided by an embodiment of the present application are described below in conjunction with a method for managing the read and write permissions of a shared memory of a CXL memory expansion device in the current technology.

[0044] The following, in conjunction with Figure 1, briefly describes the current state of the art for managing read and write permissions for shared memory on a CXL memory expansion device. As shown in Figure 1, the system includes a server 110, a server 120, and a CXL memory expansion device 130. Applications 111 on server 110 and 121 on server 120 share the same shared memory 131 on CXL memory expansion device 130. Additional software is introduced as a manager (as shown in Figure 1 as manager 140) for managing read and write permissions for shared memory 131 (i.e., shared memory). It should be noted that manager 140 can run on server 110, server 120, or any other server (the location of manager 140 is not shown in Figure 1).

[0045] To ensure the consistency and reliability of the data in shared memory 131, when application 111 has obtained the write permission for shared memory 131, application 121 cannot successfully obtain the write permission for shared memory 131. If application 111 has obtained the write permission for shared memory 131, and application 121 also obtains the write permission for shared memory 131, then both application 111 and application 121 can write to shared memory 131. If application 111 and application 121 both rewrite new data to the same storage area of ​​shared memory 131, and the data written by application 111 is different from the data written by application 121, shared memory 131 cannot correctly store the rewritten data, resulting in uncertainty in the data stored in shared memory 131, and thus the consistency and reliability of the data stored in shared memory 131 cannot be guaranteed.

[0046] Taking application 121 applying for write permission to shared memory 131 as an example, in the current technology, application 121 sends a request to the administrator 140 to obtain write permission to shared memory 131. If the administrator 140 has write permission to shared memory 131 at this time, it means that the current application 111 has not obtained write permission to shared memory 131, and application 111 has not performed write operation on shared memory 131 at this time, so application 121 can perform write operation on shared memory 131. Then the administrator 140 assigns write permission to shared memory 131 to application 121. When application 121 obtains write permission to shared memory 131, When the administrator 140 has the write permission for the shared memory 131, the application 121 can perform write operations on the shared memory 131 (for example, the application 121 writes new data to the shared memory 131); if the administrator 140 does not have the write permission for the shared memory 131 at this time, it means that the administrator 140 has assigned the write permission for the shared memory 131 to the application 111, that is, the application 111 has obtained the write permission for the shared memory 131, and the application 111 can perform write operations on the shared memory 131. In order to ensure the consistency and reliability of the data in the shared memory 131, the application 121 fails to obtain the write permission for the shared memory 131.

[0047] Current technology manages read and write permissions for shared memory 130 by additionally referencing a manager 140 running on a server node. This consumes additional CPU power on the server where manager 140 is deployed, resulting in decreased server performance and increased deployment costs. Furthermore, if manager 140 fails or crashes during operation, neither server 110 nor server 120 can access shared memory 131 (i.e., neither application 111 nor application 121 can access shared memory 131). Servers 110 and 120 can simply be understood as having lost the data stored in shared memory 131, leading to serious reliability issues.

[0048] Furthermore, in current technology, all read and write permission requests for shared memory 131 must be processed by manager 140. This means that all read and write permission requests for multiple applications using the same shared memory on a CXL memory expansion device must be processed by a single manager. When multiple applications using the same shared memory on a CXL memory expansion device request read and write permissions for the shared memory, the manager may become a performance bottleneck for the entire system, limiting the system's concurrent performance. Furthermore, due to the CPU limitations of the server hosting manager 140, manager 140's performance is also limited, impacting its ability to manage read and write permissions for shared memory 131.

[0049] Furthermore, in the current technology, since the administrator 140 runs on any one of the multiple server nodes, for example, the administrator 140 runs on the server 110, when the application 121 running on the server 120 applies for read and write permissions to the shared memory 131, it is necessary to send a request for read and write permissions to the administrator 140 running on the server 110 across the network, which will consume additional CPU computing power, thereby reducing the performance of the server and even the entire system.

[0050] The embodiment of the present application provides a method for managing the read and write permissions of a shared memory, which is applied to a CXL memory expansion device, and implements the management of the read and write permissions of the shared memory through the CXL memory expansion device. Specifically, it implements the allocation and recovery of the read and write permissions of the shared memory. There is no need to introduce additional software running on the server as a manager of the read and write permissions of the shared memory of the CXL memory expansion device (hereinafter simply referred to as "manager"), so that the management of the read and write permissions of the shared memory can be achieved, thereby avoiding the consumption of CPU computing power caused by the server running the manager, improving the performance of the server, and not requiring additional deployment of managers, reducing deployment costs. Furthermore, since there is no need to introduce additional managers in the embodiment of the present application, the reliability problem of being unable to access the shared memory due to a failure or crash of the manager during operation is avoided.

[0051] Furthermore, the embodiment of the present application implements the management of read and write permissions of shared memory through the CXL memory expansion device, without the need to introduce additional administrators running on the server, thereby avoiding the administrator's restriction on the concurrency performance of the entire system.

[0052] Furthermore, the embodiment of the present application implements the management of read and write permissions of shared memory through the CXL memory expansion device. Only the server and the corresponding CXL memory expansion device need to interact to process the read and write permission requests of shared memory. There is no need to process the shared memory read and write permission requests across servers through the network, thereby reducing the additional consumption of CPU computing power.

[0053] The above comparison with Figure 1 illustrates the advantages of a shared memory read and write permission management method provided in an embodiment of the present application. Below, with reference to Figures 2 and 3, two application scenarios of a shared memory read and write permission management method provided in an embodiment of the present application are illustrated by way of example.

[0054] Before introducing the shared memory read and write permission management provided by the embodiments of this application, we first describe the specific structure of the CXL memory expansion device. The CXL memory expansion device provides extended memory for servers, allowing the server to utilize the CXL memory expansion device's memory resources to achieve larger-scale memory access and data processing capabilities. Specifically, the CXL memory expansion device includes a CXL controller and memory connected to the CXL controller.

[0055] The CXL controller is a key component that connects the server and the memory (CXL memory) of the CXL memory expansion device. It manages data transmission, protocol conversion, and address mapping. The CXL controller can be the control chip integrated into the CXL memory expansion device. This control chip can also be called a memory expansion (CXL memory expander) chip, a CXL memory expander controller, or a CXL memory expander pooling chip.

[0056] The memory connected to the CXL controller may be a memory stick, a high-speed memory module (such as DRAM), or other types of storage devices, such as a non-volatile memory.

[0057] The above briefly introduces the specific structure of the CXL memory expansion device. The following, with reference to FIG2 and FIG3 , introduces two application scenarios of a shared memory read and write permission management method provided by an embodiment of the present application.

[0058] As shown in Figure 2 , CXL memory expansion device 220 is a single-port CXL memory expansion device. This means it only provides one external port, so it can only be connected to one server. The single port of CXL memory expansion device 220 is connected to server 210. Applications 211 and 212 are two application programs running on server 210. Applications 211 and 212 can normally access shared memory 221 of CXL memory expansion device 220.

[0059] It should be noted that Figure 2 only shows two applications running on the server 210 sharing the shared memory 221. In addition, three, four, etc. applications running on the server 210 may also share the shared memory 221. This embodiment of the present application does not make specific limitations.

[0060] As shown in Figure 3 , CXL memory expansion device 330 is a dual-port CXL memory expansion device. Its two ports are connected to server 310 and server 320, respectively. Application 311 is an application running on server 310, and application 321 is an application running on server 320. Applications 311 and 321 can normally access shared memory 331 on CXL memory expansion device 330.

[0061] It should be noted that Figure 3 only shows that one application running on each of the two servers shares the shared memory 331. In addition, multiple applications running on the server 310 and multiple applications running on the server 320 may share the shared memory 331. This embodiment of the present application does not make any specific limitations.

[0062] The above descriptions, in conjunction with FIG2 and FIG3 , respectively introduce application scenarios of a single-port CXL memory expansion device and a dual-port CXL memory expansion device. In addition, the present invention can also be applied to a quad-port CXL memory expansion device, an octal-port CXL memory expansion device, etc., which is not specifically limited in the embodiments of the present application.

[0063] With reference to the application scenarios shown in Figures 2 and 3, the following describes a method for managing read and write permissions for a shared memory provided by an embodiment of the present application. Before introducing the method for managing read and write permissions for a shared memory provided by an embodiment of the present application, a detailed description of a shared memory read and write permission management system provided by an embodiment of the present application will be given in conjunction with Figure 4. The system is described using a dual-port CXL memory expansion device and two servers connected to the dual-port CXL memory expansion device as an example.

[0064] 4 , the system includes server 410 , server 420 , and CXL memory expansion device 430 . Application 411 is an application program running on server 410 , and application 421 is an application program running on server 421 . Applications 411 and 421 share shared memory 431 on CXL memory expansion device 430 .

[0065] In particular, CXL memory expansion device 430 can, based on a server's request for write permission for shared memory, assign write permission to the server if the shared memory write permission is unassigned, and change the shared memory write permission assignment to assigned. CXL memory expansion device 430 can also, based on a server's request for read permission for shared memory, update the shared memory read permission assignment status. The read permission assignment status indicates the number of servers that have been assigned read permission.

[0066] For example, when the write permission allocation status is unallocated, the identifier indicating the write permission allocation status is a preset value, and when the write permission allocation status is allocated, the identifier indicating the write permission allocation status is a given value. The allocation status of the read permission of the shared memory is updated. For example, if the original read permission allocation status indicates that the read permission has been allocated to two servers, the updated read permission allocation status indicates that the read permission has been allocated to three servers.

[0067] In one possible implementation, the aforementioned process of allocating read and write permissions to the shared memory can be implemented by adding or modifying a software logic module in the CXL controller of the CXL memory expansion device 430. For example, the aforementioned process of allocating read and write permissions to the shared memory can be implemented by modifying the firmware (FW); or the aforementioned process of allocating read and write permissions to the shared memory can be implemented by adding a hardware module to the CXL controller.

[0068] In one possible implementation, as shown in Figure 4 , the aforementioned shared memory write permission allocation process can be implemented using compare-and-swap (CAS) atomic operations. Consequently, the CXL memory expansion device 430 is internally enhanced with functionality for processing CAS atomic operations to implement the shared memory write permission allocation process within the CXL memory expansion device 430.

[0069] The compare-and-swap (CAS) atomic operation is an atomic operation used to achieve synchronization in multithreaded systems. The CAS atomic operation compares the contents of a specified memory location (a flag indicating the allocation of write permissions) with a set value (a preset value). Only if the contents of the memory location match the set value will the contents of the memory location be modified to the new value.

[0070] In one possible implementation, the aforementioned shared memory read permission allocation process can be implemented using atomic acquire and add (FAA) operations. Subsequently, the CXL memory expansion device 430 is internally enhanced with functionality for processing FAA atomic operations to implement the shared memory read permission allocation process.

[0071] Among them, the fetch-and-add (FAA) atomic operation is to increase the content of the storage location by a specified value.

[0072] Because atomic operations are uninterruptible, CAS and FAA atomic operations cannot be interrupted by other threads or processors, thus ensuring data consistency in concurrent environments. Furthermore, with the rapid advancement of science and technology, the CXL controllers of currently common CXL memory expansion devices now support atomic operation instructions, enabling fast and low-latency execution of atomic operations, better meeting the high-speed and low-latency requirements of the CXL specification.

[0073] Servers 410 and 420 can send requests for shared memory read or write permissions to CXL memory expansion device 430. In one possible implementation, servers 410 and 420 add support for CAS and FAA atomic operation commands. Specifically, the CXL.io.atomic atomic operation function can be added to servers 410 and 420 (server side). In this way, applications 411 and 421 on servers 410 and 420 can issue atomic operation commands to CXL memory expansion device 430 via the CXL.io.atomic protocol, so that CXL memory expansion device 430 responds to the atomic operation commands and processes the corresponding atomic operations.

[0074] Based on a shared memory read and write permission management system as shown in FIG4 , since the CXL memory expansion device can manage the write permission and read permission of the shared memory, and the server side adds a process of sending a request for shared memory read permission or write permission to the CXL memory expansion device 430, the CXL memory expansion device can implement the read and write permission management function of the shared memory without the need to introduce an additional manager, thereby avoiding the consumption of CPU computing power caused by the server running the manager, improving the performance of the server, and without the need to deploy an additional manager, reducing the deployment cost. Furthermore, since the embodiment of the present application does not require the introduction of an additional manager, the reliability problem of being unable to access the shared memory due to a failure or crash of the manager during operation is avoided. For ease of understanding, the following describes how to implement the management of shared memory read and write permissions through multiple embodiments. Among them, the read and write permission management method may include a write permission management method and a read permission management method.

[0075] Example 1:

[0076] 5A to 8 , a method for managing write permissions for shared memory provided by an embodiment of the present application will be described in detail. For ease of description, the following example illustrates an application 411 running on a server 410 applying for write permissions to a shared memory 431 of a CXL memory expansion device 430 and an application 411 running on the server 410 releasing write permissions to the shared memory 431.

[0077] First, in conjunction with Figures 5A to 7, a detailed description is given of how to obtain write permission for a shared memory in an embodiment of the present application. As shown in Figure 5A, the following steps are included:

[0078] S501 : The server 410 sends a request for obtaining write permission for the shared memory 431 to the CXL memory expansion device 430 .

[0079] Exemplarily, the application 411 in the server 410 sends a request for obtaining write permission for the shared memory 431 to the CXL controller of the CXL memory expansion device 430 .

[0080] The write permission acquisition request carries first comparison data (cmp data) and first swap data (swap data).

[0081] The first comparison data (cmp data) is used to compare with the data stored in the specific memory area of ​​the shared memory 431. Specifically, the first comparison data is a preset value. For example, in general, the first comparison data is set to a value of 0.

[0082] The first swap data is used to modify the data stored in the specific memory area to the first swap data when the comparison data is identical to the data stored in the specific memory area. The first swap data is a unique identifier for indicating the sender of the write permission acquisition request.

[0083] In one possible implementation, the first exchange data includes the unique identifier of the server (i.e., the unique identifier of the server 410) and the unique identifier of the current process (exemplarily, the process ID, process_id). The unique identifier of the server and the unique identifier of the current process can be combined to uniquely identify the sender of the write permission acquisition request, that is, the application of the server that sends the write permission acquisition request. Furthermore, the unique identifier of the current process is a unique identifier that can identify the currently ongoing process. In an environment where multiple processes are concurrent, the unique identifier of the current process can uniquely determine the currently executing operation process and ensure the accuracy of the execution of atomic operations.

[0084] In one possible implementation, the write permission request also includes a unique identifier for a shared data area of ​​shared memory 431. Since the extended memory of a CXL memory expansion device is generally in the form of a memory pool, shared memory 431 includes one or more shared data areas (i.e., memory blocks). Generally, application 411 sends a write permission request for the target shared data area.

[0085] S502 : The CXL memory expansion device 430 reads the first data in the shared memory 431 in response to the write permission acquisition request sent by the server 410 .

[0086] Specifically, the CXL controller of the CXL memory expansion device 430 confirms the allocation of the write permission of the shared memory in response to the write permission acquisition request sent by the application 411 , and reads the first data in the shared memory 431 in the storage connected to the CXL controller.

[0087] Among them, the first data is the data stored in the first area of ​​the meta space in the shared memory 431, and is an identifier for indicating the allocation of the write permission of the shared memory 431. Specifically, when the first data is a preset value, that is, the first data is the same as the first comparison data, it indicates that the write permission of the shared memory 431 is not allocated to any application, that is, the allocation of the write permission of the shared memory is unallocated; when the first data is not a preset value, that is, the first data is different from the first comparison data, it indicates that the write permission of the shared memory 421 has been allocated to other applications, and the allocation of the write permission of the shared memory is allocated. For example, assuming that the first comparison data is 0, that is, the preset value is 0, when the first data is 0, it indicates that the write permission of the shared memory 431 is not allocated to any application; when the first data is not 0, it indicates that the write permission of the shared memory 431 has been allocated to other applications.

[0088] Meta space, also referred to as meta area for short, is a meta area in the shared memory 431 in the embodiment of the present application, used to store data related to read and write permission allocation.

[0089] For easier understanding, the structure of the shared data area is illustrated below with reference to FIG6 .

[0090] As shown in Figure 6, the structure of the shared data area consists of a metaspace and a valid data area. For example, the metaspace is located at the head of the shared data area and can have a capacity of 64 bits. The remaining memory area is the valid data area, which is used to store valid data. The metaspace includes a first area and a second area. The data stored in the first area is the first data; the data stored in the second area is the second data.

[0091] For example, taking the first exchange data as 0, that is, the preset value as 0, when the first data is 0, it means that the write permission of the shared memory 431 has not been allocated; when the first data is not 0, it means that the write permission of the shared memory 431 has been allocated.

[0092] S503 : The CXL memory expansion device 430 determines whether the first comparison data is identical to the first data.

[0093] Specifically, the CXL controller of the CXL memory expansion device 430 determines whether the first comparison data and the first data are identical.

[0094] When the CXL controller of the CXL memory expansion device 430 determines that the first comparison data is identical to the first data, step S504 is performed first, and then step S505 is performed.

[0095] When the CXL controller of the CXL memory expansion device 430 determines that the comparison data is different from the first data, the process directly proceeds to S505 .

[0096] For example, taking the preset value of 0 as an example, when the first data is 0 (the first comparison data is the same as the first data), it means that the write permission of the current shared memory 431 has not been assigned to any application, that is, the application 411 and the application 421 corresponding to the shared memory 431 have not obtained the write permission of the shared memory 431, so the application 411 can successfully obtain the write permission of the shared memory 431. When the first data is not 0 (the first comparison data is different from the first data), it means that the write permission of the current shared memory 431 has been assigned to other applications, that is, the application 421 has obtained the write permission of the shared memory 431, so the application 411 cannot obtain the write permission of the shared memory 431. Further, the first data can indicate the application that currently obtains the write permission of the shared memory 431.

[0097] S504 : The CXL memory expansion device 430 modifies the first data stored in the shared memory 431 into first exchange data.

[0098] Specifically, the CXL controller of CXL memory expansion device 430 modifies the first data stored in shared memory 431 in the storage to first exchange data, i.e., modifies the allocation of the write permission of the shared memory to "allocated." The first exchange data indicates that the allocation of the write permission of shared memory 431 is "allocated," and the first exchange data is the given value described above.

[0099] For example, assuming the preset value is 0, when the first data is 0, it indicates that the write permission for shared memory 431 has not been assigned to any application. Therefore, application 411 on server 410 can successfully obtain write permission for shared memory 431. Therefore, CXL memory expansion device 430 modifies the first data into first exchange data, assigning write permission for shared memory 431 to application 411 on server 410. CXL memory expansion device 430 modifies the first data into the unique identifier of server 410 and the unique identifier of the current process, assigning write permission for shared memory 431 to server 410. This allows server 410 to perform write operations on shared memory 431, for example, server 410 can write new data to shared memory 431. Furthermore, when other servers 410 read the first data from shared memory 431 and find that it contains the unique identifier of server 410 and the unique identifier of the process, they know that the write permission for shared memory 431 has been assigned to server 410 and cannot successfully obtain write permission for shared memory 431.

[0100] Furthermore, when the CXL memory expansion device 430 determines that the first comparison data and the first data are different, it indicates that the write permission of the shared memory 431 has been allocated, that is, the application 411 cannot successfully obtain the write permission of the shared memory 431. Therefore, before S505, the CXL memory expansion device 430 does not perform any operation.

[0101] In one possible implementation, S503 and S504 can be implemented by the CXL memory expansion device 430 performing a CAS atomic operation. To facilitate understanding of how the CXL memory expansion device 430 performs the CAS atomic operation to implement S503 and S504, the following illustrates pseudo code for implementing the CAS atomic operation in the CXL memory expansion device 430 with reference to FIG7 .

[0102] The first comparison data (Compare Data) and the original first data (Original Remote Data Value) are XORed. When the first comparison data is the same as the original first data, the XOR result is 0; when the first comparison data is different from the original first data, the XOR result is 1. Exemplarily, the first comparison data is pre-set to 0. Then, when the original first data is 0, the XOR result is 0; when the original first data is not 0, the XOR result is 1. The XOR result is ANDed with the comparison mask (Compare Mask). The comparison mask is pre-set to 1. When the XOR result is 0, the AND result of 0 and the comparison mask is 0; when the XOR result is 1, the AND result of 1 and the comparison mask is 1. A NOT operation is performed on the AND result. When the AND result is 0, the NOT result is 1; when the AND result is 1, the NOT result is 0.

[0103] If the result of the NOT operation is true, that is, the result of the NOT operation is 1, then the if condition is met, and the first data (Remote Data Value) is modified to the first swap data (Swap Data), indicating that the write permission for the shared memory is successfully obtained. Specifically, the first data is updated through the following operations: the swap mask is 1, and the original first data (Original Remote Data Value) and the inverted value of the swap mask are ANDed. Since the inverted value of the swap mask is 0, the result of the AND operation is 0; the first swap data and the swap mask are ANDed. Since the swap mask is 1, the result of the AND operation is the swap data; the swap data is ORed with the value 0, and the result of the OR operation is the first swap data.

[0104] If the NOT operation result is false, that is, the NOT operation result is 0, the if condition is not met, and the first data is not updated, indicating that the acquisition of the write permission of the shared memory fails. Specifically, the first data remains equal to the original first data.

[0105] S505 : The CXL memory expansion device 430 returns the original first data to the server 410 .

[0106] Specifically, the CXL controller of the CXL memory expansion device 430 returns the original first data to the server 410 , and correspondingly, the application 411 of the server 410 receives the original first data.

[0107] Specifically, when the CXL memory expansion device 430 determines that the first comparison data and the first data are the same, the first data is modified to the first exchange data. At this time, the original first data is the first data before modification (the first data that is the same as the first comparison data, that is, the preset value); when the CXL memory expansion device 430 determines that the first comparison data and the first data are not the same, no operation is performed, so the first data has not changed, and the original first data and the current first data are the same.

[0108] S506 : The server 410 determines whether the acquisition of the write permission of the shared memory 431 is successful based on the received original first data.

[0109] When the original first data is identical to the first comparison data, it indicates that the application 411 of the server 410 has successfully obtained the write permission for the shared memory 431. When the application 411 of the server 410 has successfully obtained the write permission for the shared memory 431, the application 411 of the server 410 can perform a write operation on the shared memory 431, for example, write new data to the shared memory 431.

[0110] When the original first data is different from the first comparison data, obtaining the write permission of the shared memory 431 fails. The application 411 of the server 410 cannot perform any write operation on the shared memory 431 .

[0111] For example, taking the first comparison data as 0, when the original first data is 0, it means that the application 411 successfully obtains the write permission of the shared memory 431; when the original first data is not 0, it means that the application 411 fails to obtain the write permission of the shared memory 431.

[0112] In this embodiment, the CXL memory expansion device 430 implements the allocation of shared memory write permissions. This eliminates the need for a manager, avoiding the additional CPU consumption on the server caused by running a manager. This improves server performance and, in turn, overall system performance. Furthermore, the need for deploying additional managers reduces deployment costs. Furthermore, reliability issues caused by manager failures or crashes during operation are avoided.

[0113] Furthermore, the CXL memory expansion device implements the allocation / management of write permissions for shared memory, eliminating the need to allocate write permissions for shared memory across servers over the network, thereby reducing the additional consumption of CPU computing power.

[0114] Furthermore, in this embodiment of the present application, the aforementioned write permission allocation process can be implemented using atomic CAS operations, which are not interrupted by other threads or processors, ensuring data consistency in a concurrent environment. This allows the CXL memory expansion device to execute multiple atomic CAS operations simultaneously, eliminating administrator restrictions on the overall system's concurrency performance.

[0115] Of course, in other embodiments, the read-write permission management method shown in FIG5B may include:

[0116] S1: Receive a write permission acquisition request for a shared memory sent by a server; the write permission acquisition request carries first comparison data and first exchange data.

[0117] S2: In response to receiving the write permission acquisition request, read first data in the shared memory; the first data is data stored in a first area in the metaspace of the shared memory, and is used to indicate allocation status of the write permission of the shared memory.

[0118] It can be understood that the specific solutions of the above S1 and S2 can be referred to in the specific description of the above S502 and will not be repeated here.

[0119] S3: When the first comparison data is the same as the first data, the first data in the shared memory is modified to the first exchange data, so as to allocate the write permission of the shared memory to the server.

[0120] It can be understood that the specific solution of the above S3 can be referred to in the specific description of the above S503 and S504, and will not be repeated here.

[0121] The CXL memory expansion device 430 enables the allocation of shared memory write permissions. This allows for the allocation of shared memory write permissions without the need for an administrator, eliminating the additional CPU consumption on the server caused by running an administrator. This improves server performance and, ultimately, overall system performance. Furthermore, the need for deploying an additional administrator reduces deployment costs. Furthermore, reliability issues caused by administrator failures or crashes during operation are avoided.

[0122] The above details how to obtain the write permission of the shared memory in the embodiment of the present application in conjunction with Figures 5A-7. The following details how to release the write permission of the shared memory in the embodiment of the present application in conjunction with Figure 8. It should be noted that the server generally releases the write permission of the shared memory in a timely manner after completing the write operation. Specifically, as shown in Figure 8, the release process of the write permission of the shared memory in the embodiment of the present application includes the following steps:

[0123] S801 : The server 410 sends a write permission release request for the shared memory 431 to the CXL memory expansion device 430 .

[0124] Specifically, the application 411 running on the server 410 sends a write permission release request for the shared memory 431 to the CXL memory expansion device 430 .

[0125] Among them, the write permission release request carries a second comparison data and a second exchange data. Specifically, the second comparison data is a unique identifier used to indicate the sender of the write permission release request, and the second exchange data is a preset value. It can be understood that the second comparison data carried by the write permission release request sent by the server for the shared memory is the first exchange data carried by the write permission acquisition request sent by the server for the shared memory; the second exchange data carried by the write permission release request sent by the server for the shared memory is the first comparison data carried by the write permission acquisition request sent by the server for the shared memory, that is, the preset value.

[0126] In one possible implementation, since server 410 has obtained write permission for shared memory 431, application 411 can send a write permission release request to the metaspace of shared memory 431 of CXL memory expansion device 430. Specifically, the write permission release can also be implemented based on a CAS atomic operation. The write permission release request is a CAS atomic operation command, the second comparison data carried in the write permission release request is the unique identifier of the server and the unique identifier of the process, and the second exchange data carried in the write permission release request is a preset value.

[0127] S802 : The CXL memory expansion device 430 modifies the first data into second exchange data in response to the write permission release request sent by the server 410 .

[0128] Specifically, the CXL controller of the CXL memory expansion device 430 responds to the write permission release request sent by the application 411 in the server 410, compares the first data with the second comparison data to see whether they are the same. By default, if they are the same, because if the write permission of the shared memory 431 is not successfully obtained, the write permission of the shared memory 431 will not be released; if the first data is the same as the second comparison data carried in the write permission release request, the first data is modified to the second exchange data carried in the write permission release request (the first data is modified to a preset value), that is, the allocation status of the write permission of the shared memory is modified to unallocated.

[0129] Exemplarily, the second exchange data carried in the write permission release request is generally set to 0.

[0130] S803 : The server 410 sends a read request for the first data in the shared memory 431 to the CXL memory expansion device 430 .

[0131] Exemplarily, the application 411 of the server 410 sends a read request for first data in the metaspace of the shared memory 431 to the CXL memory expansion device 430 , requesting to read the first data in the metaspace of the shared memory 431 .

[0132] S804 : CXL memory expansion device 430 returns the first data to server 410 .

[0133] S805 : The server 410 determines whether the release of the write permission of the shared memory 431 is successful based on the received first data.

[0134] When the first data is the same as the second exchange data of the write permission release request, that is, the first data is the preset value, it means that the server 410 has successfully released the write permission of the shared memory 431; when the first data is not the same as the second exchange data of the write permission release request, it means that the server 410 has failed to release the write permission of the shared memory 431.

[0135] In the embodiment of the present application, by modifying the first data in the shared memory 431 of the CXL memory expansion device 430 to a preset value, the write permission of the shared memory 431 can be released, so that other servers can obtain the write permission of the shared memory 431 and perform write operations on the shared memory 431.

[0136] Example 2:

[0137] 9 and 10 , a method for managing shared memory write permissions provided by an embodiment of the present application will be described in detail. For ease of description, the following examples illustrate how an application 421 running on a server 420 applies for read permissions on a shared memory 431 of a CXL memory expansion device 430 and how the application 421 running on the server 420 releases the read permissions on the shared memory 431.

[0138] First, multiple applications (multiple servers) can simultaneously have read access to shared memory (for example, application 421 has successfully obtained read access to shared memory 431, while application 411 can also successfully obtain read access to shared memory 431). Read access to shared memory does not need to be exclusive to a single application. This is because after an application obtains read access to shared memory, it only reads the data stored in the shared memory and does not modify the data stored in the shared memory, which does not affect the consistency and reliability of the data stored in the shared memory.

[0139] 9, the following describes in detail how to obtain the read permission of the shared memory in the embodiment of the present application. As shown in FIG9, the following steps are included:

[0140] S901 : The server 420 sends a request for obtaining read permission for the shared memory 431 to the CXL memory expansion device 430 .

[0141] Specifically, the application 421 running on the server 420 sends a request for obtaining read permission for the shared memory 431 to the CXL memory expansion device 430 .

[0142] The read permission acquisition request carries first added data, and the first added data is +1.

[0143] Furthermore, the read permission acquisition request also carries a memory address for indicating the shared memory address that the server 420 targets to access. Exemplarily, the memory address carried in the read permission acquisition request is used to indicate the shared memory 431 .

[0144] In a possible implementation, the shared memory 431 includes one or more shared data areas (memory blocks). When the shared memory 431 includes multiple shared data areas, the memory address of the read permission acquisition request can indicate the target shared data area in the shared memory 431.

[0145] S902 : The CXL memory expansion device 430 reads the second data from the shared memory 431 in response to the read permission acquisition request sent by the server 420 .

[0146] Specifically, the CXL controller of the CXL memory expansion device 430 reads the second data of the shared memory 431 on the memory of the CXL memory expansion device 430 in response to the read permission acquisition request sent by the server 420 .

[0147] The second data is data stored in the second region of the metaspace in shared memory 431. The second data indicates the allocation of read permissions for the shared memory. For example, the second data is read permission reference count data (read_ref_cnt), which indicates how many applications have read permissions assigned to the current shared memory 431 / shared data region. For example, before application 421 on server 420 applies for read permissions for shared memory 431, application 411 running on server 410 has already obtained read permissions for shared memory 431. In this case, the second data in shared memory 431 read by CXL memory expansion device 430 is 1.

[0148] S903 : The CXL memory expansion device 430 adds the second data and the first added data to obtain a first addition result, and modifies the second data in the shared memory 431 into the first addition result.

[0149] Specifically, the CXL memory expansion device 430 adds the second data and the first added data carried by the read permission acquisition request to obtain a first addition result, and writes the first addition result to overwrite the original second data, and the storage location is still the second area of ​​the metaspace of the shared memory 431 to update the allocation of read permissions of the shared memory. The allocation of read permissions is used to indicate the number of servers that have been assigned read permissions.

[0150] For example, if the first incremented data in the read permission request is 1 and the second incremented data is 1, the CXL memory expansion device 430 obtains a first addition result of 2, and modifies the second incremented data in the shared memory 431 from 1 to 2. This indicates how many servers (applications) have currently obtained read permission for the shared memory 431.

[0151] After the second data in the shared memory 431 is modified to the first addition result, the server 420 completes the acquisition of the read permission of the shared memory 431 .

[0152] In one possible implementation, S902 and S903 may be implemented by the CXL memory expansion device 430 executing an FAA atomic operation. It should be noted that when the CXL memory expansion device 430 executes an FAA atomic operation to allocate read permissions to the shared memory 431, the read permission acquisition request is an FAA atomic operation command, also referred to as fetch_add.

[0153] S904 : CXL memory expansion device 430 returns the original second data to server 420 .

[0154] Specifically, CXL memory expansion device 430 returns the original second data to application 421 on server 420, indicating that application 421 has successfully obtained read permission for shared memory 431. That is, when application 421 receives the original second data returned by CXL memory expansion device 430, it indicates that application 421 has obtained read permission for shared memory 432 and can read / access data in shared memory 431.

[0155] The above, combined with Figure 9, details how to obtain the read permission of the shared memory in the embodiment of the present application. It should be noted that the server will generally release the read permission of the shared memory in a timely manner after completing the read operation, which can avoid erroneous operations that continue to read data in the shared memory, causing additional consumption of resources; and timely release of the read permission of the shared memory helps to avoid security risks caused by excessive permissions, and also prevents other users or processes from accidentally changing or destroying data with this permission. The following, combined with Figure 10, details how to release the read permission of the shared memory in the embodiment of the present application. As shown in Figure 10, the following steps are included:

[0156] S1001 : The server 420 sends a read permission release request for the shared memory 431 to the CXL memory expansion device 430 .

[0157] The read permission release request carries second added data, and the second added data is -1.

[0158] S1002 : The CXL memory expansion device 430 reads the second data from the shared memory 431 in response to the read permission release request sent by the server 420 .

[0159] Specifically, the CXL controller of the CXL memory expansion device 430 reads the second data of the shared memory 431 in the storage in response to the read permission release request sent by the server 420 .

[0160] S1003 : The CXL memory expansion device 430 adds the second data and the second added data to obtain a second addition result, and modifies the second data in the shared memory 431 into the second addition result.

[0161] Specifically, the CXL memory expansion device 430 adds the second data and the second added data carried by the read permission release request to obtain a second addition result, and writes the second addition result into and overwrites the original second data, and the storage location is still the second area of ​​the metaspace of the shared memory 431 to update the allocation of the read permission of the shared memory.

[0162] Exemplarily, the second added data carried in the read permission acquisition request is -1. Assuming the second data is 1, the second addition result obtained by the CXL memory expansion device 430 is 0, and the second data of the shared memory 431 is modified from 1 to 0.

[0163] After the second data in the shared memory 431 is modified to the addition result, the server 420 completes the release of the read permission of the shared memory 431 .

[0164] In a possible implementation, the above S1002 and S1003 may be implemented by the CXL memory expansion device 430 performing an FAA operation.

[0165] S1004 : CXL memory expansion device 430 returns the original second data to server 420 .

[0166] Specifically, CXL memory expansion device 430 returns the original second data to server 420 to notify server 420 that it has successfully released the read permission for shared memory 431. That is, when server 420 receives the original second data returned by CXL memory expansion device 430, server 420 has already released the read permission for shared memory 432 and cannot read or access the data in shared memory 431.

[0167] In the embodiments of the present application, the CXL memory expansion device 430 can allocate and reclaim shared memory read permissions without requiring a manager. This eliminates the extra CPU consumption on the server caused by running a manager, improving server performance and even overall system performance. Furthermore, the deployment cost is reduced by eliminating the need for an additional manager. Furthermore, reliability issues caused by manager failures or crashes during operation are avoided.

[0168] Furthermore, the CXL memory expansion device implements the allocation and recovery of shared memory read permissions internally, eliminating the need to implement this across servers over the network, thereby reducing the additional consumption of CPU computing power.

[0169] Furthermore, in this embodiment of the present application, the read permission acquisition process can be implemented using FAA atomic operations. FAA atomic operations are not interrupted by other threads or processors, ensuring data consistency in a concurrent environment. This allows the CXL memory expansion device to execute multiple FAA atomic operations simultaneously, eliminating the need for administrators to limit the concurrency performance of the entire system.

[0170] The above, combined with Example 1 and Example 2, respectively introduces how to implement the allocation and recovery of shared memory write permissions and how to implement the allocation and recovery of shared memory read permissions in the embodiments of this application. As can be seen from Example 1 and Example 2, in the embodiments of this application, the management of shared memory read and write permissions is completed within the CXL memory expansion device, eliminating the need to deploy additional administrators on the server to manage shared memory read and write permissions, reducing the additional consumption of server CPU computing power and lowering deployment costs.

[0171] Furthermore, the management of shared memory read and write permissions is handled within the CXL memory expansion device. This prevents administrators from being unable to access shared memory due to failures or crashes during operation, improving overall system reliability. Furthermore, this reduces the complexity of shared memory read and write permission management.

[0172] Furthermore, the above-mentioned allocation process of read and write permissions of the shared memory can be implemented through atomic operations. Therefore, in the embodiment of the present application, the read and write permission requests of the shared memory can be processed separately through multiple atomic operations. There is no need for all read and write permissions of the shared memory to be processed by the administrator, thereby avoiding the administrator's restrictions on the concurrency performance of the entire system and improving the concurrency performance of the entire system.

[0173] Furthermore, for multi-port CXL memory expansion devices, only the server and the corresponding CXL memory expansion device need to interact to process read and write permission requests. There is no need to process shared memory read and write permission requests across servers over the network, reducing the additional consumption of CPU computing power.

[0174] Example 3:

[0175] 11, a shared memory read and write permission management device provided by an embodiment of the present application is described in detail. The device is applied to a CXL memory expansion device. As shown in FIG11, the shared memory read and write permission management device 1100 includes the following modules:

[0176] The write permission request receiving module 1101 is configured to receive a write permission acquisition request for a shared memory sent by a server; the write permission acquisition request carries first comparison data and first exchange data;

[0177] A first data reading module 1102 is configured to read first data in the shared memory in response to receiving a write permission acquisition request; the first data is data stored in a first region in a metaspace of the shared memory and is configured to indicate allocation of write permissions to the shared memory;

[0178] The first data modification module 1103 is configured to modify the first data in the shared memory into the first exchange data when the first comparison data is identical to the first data, so as to allocate the write permission of the shared memory to the server.

[0179] In one possible implementation, the write permission request receiving module 1101 is also used to receive a write permission release request for the shared memory sent by the server; the write permission release request carries second comparison data and second exchange data; the first data reading module 1102 is also used to read the first data in the shared memory in response to the reception of the write permission release request; the first data modification module 1103 is also used to modify the first data in the shared memory to the second exchange data in response to the first data being the same as the second comparison data, so as to realize the recovery of the write permission of the shared memory.

[0180] In a possible implementation, the device further includes: a first data returning module, configured to return the original first data to the server, so that the server can determine whether the write permission of the shared memory is successfully obtained based on the original first data.

[0181] In one possible implementation, the first data return module is also used to return the first data of the shared memory to the server in response to a read request for the first data of the shared memory sent by the server, so that the server can determine that the write permission of the shared memory is released successfully based on the first data.

[0182] As shown in FIG11 , the shared memory read and write permission management device 1100 further includes the following modules:

[0183] The read permission receiving module 1104 is configured to receive a read permission acquisition request for a shared memory sent by a server; the read permission acquisition request carries first increment data, which is 1;

[0184] The second data reading module 1105 is configured to read the second data in the shared memory in response to receiving the read permission acquisition request; the second data is data stored in the second area of ​​the metaspace of the shared memory and is used to indicate the allocation of the read permission of the shared memory;

[0185] The second data modification module 1106 is used to add the second data to the first added data to obtain a first addition result, and modify the second data in the shared memory to the first addition result to allocate the read permission of the shared memory to the server.

[0186] In one possible implementation, the read permission receiving module 1104 is also used to receive a read permission release request for the shared memory sent by the server; the read permission release request carries second added data, which is -1; the second data reading module 1105 is also used to read the second data in the shared memory in response to the reception of the read permission release request; the second data modification module 1106 is also used to add the second data to the second added data to obtain a second addition result, and modify the second data in the shared memory to the second addition result to realize the recovery of the read permission of the shared memory.

[0187] In a possible implementation, the device further includes: a second data returning module, configured to return the original second data to the server to prompt the server that the acquisition or release of the read permission of the shared memory is successful.

[0188] The present application provides a shared memory read / write permission management device for use with a CXL memory expansion device. This shared memory read / write permission management device can implement shared memory read / write permission management functionality within the CXL memory expansion device, eliminating the need for an additional administrator. This avoids server CPU power consumption caused by running an administrator, improving server performance, and eliminating the need for additional administrator deployment, reducing deployment costs. Furthermore, because the present application eliminates the need for an additional administrator, reliability issues such as inability to access shared memory due to administrator failures or crashes during operation are avoided.

[0189] In addition, an embodiment of the present application further provides a CXL memory expansion device, which includes a CXL controller and a memory connected to the CXL controller; the memory includes a shared memory; and the CXL controller is used to execute the steps performed by the CXL memory expansion device in the shared memory read and write permission management method in the above embodiment.

[0190] An embodiment of the present application also provides a server, which includes a processor and a memory. The processor is connected to the memory, and the memory stores computer-executable instructions. When the processor executes the computer-executable instructions, it implements the server execution steps in the shared memory read and write permission management method in the above embodiment.

[0191] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is run on a computer, the computer is enabled to execute the shared memory read and write permission management method in the above embodiment.

[0192] For explanations of the relevant contents and descriptions of the beneficial effects of any of the computer-readable storage media provided above, reference may be made to the corresponding embodiments described above, and no further details will be given here.

[0193] The present application also provides a computer program product comprising instructions that, when executed on a computer, cause the computer to execute any of the shared memory read and write permission management methods described in the above embodiments. The computer program product comprises one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, hard disk, tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD).

[0194] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.

[0195] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0196] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the embodiments of the present application for which protection is sought, those skilled in the art may understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple components. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0197] Although the embodiments of the present application have been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the embodiments of the present application. Accordingly, this specification and the drawings are merely illustrative of the embodiments of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the embodiments of the present application. Obviously, those skilled in the art may make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A method for managing read and write permissions of a shared memory, characterized in that: Applied to computing a high-speed interconnect link CXL memory expansion device, the method includes: Receiving a write permission acquisition request for a shared memory sent by a server; the write permission acquisition request carries first comparison data and first exchange data; In response to receiving the write permission acquisition request, reading first data in the shared memory; the first data is data stored in a first area in the metaspace of the shared memory, and is used to indicate allocation status of the write permission of the shared memory; When the first comparison data is identical to the first data, the first data in the shared memory is modified to the first exchange data, so as to allocate the write permission of the shared memory to the server.

2. The method according to claim 1, characterized in that After modifying the first data in the shared memory into the first exchange data, the method further includes: Returning the original first data to the server so that the server can determine whether the write permission of the shared memory is successfully obtained based on the original first data; the original first data is the first comparison data.

3. The method according to claim 2, further comprising: receiving a write permission release request for the shared memory sent by the server; The write permission release request carries second comparison data and second exchange data; wherein the second comparison data is the first exchange data, and the second exchange data is the first comparison data; In response to receiving the write permission release request, reading first data in the shared memory, where the first data is the first exchange data; In response to the first data being identical to the second comparison data, the first data in the shared memory is modified to the second exchange data, so as to reclaim the write permission of the shared memory.

4. The method according to claim 3, after modifying the first data in the shared memory to the second exchange data, the method further comprises: receiving a read request for first data in the shared memory sent by the server; In response to a read request for the first data, the first data in the shared memory is returned to the server, so that the server determines, based on the first data, that the write permission of the shared memory is released successfully.

5. The method according to claim 1, wherein The method further comprises: When the first comparison data is different from the first data, the first data in the shared memory is not modified, and the first data is returned to the server, so that the server determines that the acquisition of the write permission of the shared memory has failed based on the first data.

6. A method for managing read and write permissions of a shared memory, characterized in that: Applied to computing a high-speed interconnect link CXL memory expansion device, the method includes: Receive a read permission acquisition request for a shared memory sent by a server; the read permission acquisition request carries first added data, and the first added data is 1; In response to receiving the read permission acquisition request, reading second data in the shared memory; the second data is data stored in a second area in the metaspace of the shared memory, and is used to indicate allocation of the read permission of the shared memory; The second data is added to the first added data to obtain a first addition result, and the second data in the shared memory is modified to the first addition result, so as to allocate the read permission of the shared memory to the server.

7. The method according to claim 6, characterized in that After modifying the second data in the shared memory to the first addition result, the method further includes: The original second data is returned to the server to prompt the server that the read permission of the shared memory is successfully obtained.

8. The method according to claim 7, characterized in that The method further comprises: receiving a read permission release request for the shared memory sent by the server, wherein the read permission release request carries second increment data, and the second increment data is -1; In response to receiving the read permission release request, reading second data in the shared memory; The second data and the second added data are added to obtain a second addition result, and the second data in the shared memory is modified to the second addition result, so as to reclaim the read permission of the shared memory.

9. The method according to claim 8, characterized in that After modifying the second data in the shared memory to the second addition result, the method further includes: The original second data is returned to the server to prompt the server that the read permission of the shared memory is released successfully.

10. A computational high-speed interconnect link (CXL) controller, characterized in that: The CXL controller executes the method according to any one of claims 1-5 and 6-9.

11. A computing high-speed interconnect link CXL memory expansion device, characterized in that: include: The CXL controller according to claim 10, and a memory connected to the CXL controller; The memory includes the shared memory; The CXL controller is configured to execute the method according to any one of claims 1 to 5 and 6 to 9.

Citation Information

Patent Citations

  • Lock management method and device, computing equipment and distributed system

    CN115878514A

  • Memory cache pool maintenance method, device and system and storage medium

    CN116303128A

  • Read-write authority management method of shared memory, controller and memory extension equipment

    CN118312302A

  • System and method for generating a lock-free dual queue

    US20070157200A1

  • Computation of weakly connected components in a parallel, scalable and deterministic manner

    US20230126888A1