Search

CN-121092467-B - Resource management method and device based on combination of Slab distributor and Buddy system

CN121092467BCN 121092467 BCN121092467 BCN 121092467BCN-121092467-B

Abstract

The application provides a resource management method and a device based on the combination of a Slab distributor and a Buddy system, which relate to the technical field of computers, and firstly construct the Buddy system consisting of a plurality of linked lists (recording the starting position, the interval length and the use state of an index interval); the method comprises the steps of distributing continuous index intervals from a Buddy system to construct a Slab cache region, searching and distributing available index units in the Slab cache region through a Slab distributor when a resource request is received, calling the Buddy system to distribute new continuous index intervals if no available index units exist, constructing a new Slab cache region based on the intervals, and returning the index intervals corresponding to the Slab cache region to the Buddy system if all index units in the corresponding Slab cache region are released after the index units are released. The application can effectively reduce fragments and improve the utilization rate of resources and the response speed of the system while rapidly distributing and recovering MTT resources.

Inventors

  • LIN YUKAI
  • CHEN NENG
  • YAN HONGLIANG
  • CAI XINYAO

Assignees

  • 翼华科技(北京)有限公司

Dates

Publication Date
20260508
Application Date
20250901

Claims (5)

  1. 1. A resource management method based on a slot allocator combined with a Buddy system, comprising: constructing a Buddy system consisting of a plurality of linked lists, wherein the linked lists are used for recording the starting position, the interval length and the use state of an index interval, and the index interval is divided according to the power of 2; Distributing continuous index intervals from the Buddy system to construct Slab cache areas, wherein each Slab cache area comprises a management head and a plurality of index units with fixed sizes, and the management head records idle index necklace table pointers, the use state of the Slab and the number of distributed index units; when receiving a resource request, searching and distributing available index units in the Slab cache region through a Slab distributor, wherein when distributing index units, the Slab distributor directly takes out one available index unit from an idle linked list and updates the distributed count of the management head; when no available index unit exists in the Slab cache region, calling the Buddy system to allocate a new continuous index region, and constructing a new Slab cache region based on the region; After releasing the index units, if all index units in the corresponding Slab cache region are released, returning the index region corresponding to the Slab cache region to the Buddy system, judging whether the index region can be combined with the adjacent index region, judging whether the index region is adjacent to the adjacent Buddy region and is in an idle state when the index region is returned to the Buddy system, if so, combining the index region into a larger index region, and updating a linked list structure; The method is applied to management of MTT resources in RDMA equipment, wherein the MTT resources are used for storing mapping information from virtual addresses to physical addresses.
  2. 2. The resource management method based on a combination of a Slab allocator and a Buddy system according to claim 1, wherein the number and size of the Slab cache are dynamically adjusted according to the use condition of resources when the system is running.
  3. 3. A resource management apparatus based on a slot allocator in combination with a Buddy system for performing the method of claim 1, the apparatus comprising: the first construction module is used for constructing a Buddy system consisting of a plurality of linked lists, wherein the linked lists are used for recording the starting position, the interval length and the use state of an index interval, and the index interval is divided according to the power of 2; A second construction module, configured to allocate consecutive index intervals from the Buddy system to construct slave buffer areas, where each slave buffer area includes a management header and a plurality of index units with fixed sizes; The searching module is used for searching and distributing available index units in the Slab cache region through the Slab distributor when receiving the resource request; The calling module is used for calling the Buddy system to allocate a new continuous index interval when no available index unit exists in the Slab cache region, and constructing a new Slab cache region based on the interval; and the release module is used for returning the index interval corresponding to the Slab cache region to the Buddy system and judging whether the index interval can be combined with the adjacent index interval if all the index units in the corresponding Slab cache region are released after the index units are released.
  4. 4. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of claim 1 or 2 in combination with a Buddy system based resource management method.
  5. 5. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the resource management method of claim 1 or 2 in combination with a Buddy system based on a Slab distributor.

Description

Resource management method and device based on combination of Slab distributor and Buddy system Technical Field The application relates to the technical field of computers, in particular to a resource management method and device based on combination of a Slab distributor and a Buddy system. Background In remote direct memory access (remote direct memory access, RDMA) technology, the memory translation table (Memory Translation Table, MTT) is a key structure to manage virtual address to physical address mapping, and efficient management of index resources is critical to system performance. In the prior art, MTT index resources are generally managed in a bitmap mode, and the method is simple to realize, but is difficult to effectively maintain continuous idle areas in the resource allocation process, so that memory holes are frequently generated, and the allocation efficiency of large-block resources is further affected. In addition, some of the improved schemes attempt to reduce fragmentation by using a multi-level table lookup mechanism, but this approach introduces additional hardware table lookup overhead, reduces cache hit rate, and affects access efficiency, especially in high concurrency and low latency scenarios. Therefore, how to effectively reduce fragments and improve the resource utilization rate and the system response speed while guaranteeing the rapid allocation and recovery of the MTT resources becomes a technical problem to be solved currently. Disclosure of Invention The application aims to provide a resource management method and device based on the combination of a Slab distributor and a Buddy system, so as to alleviate the technical problems in the prior art. In a first aspect, the present invention provides a resource management method based on a combination of a slot allocator and a Buddy system, including: Constructing a Buddy system consisting of a plurality of linked lists, wherein the linked lists are used for recording the starting position, the interval length and the use state of an index interval, and the index interval is divided according to the power of 2; distributing continuous index intervals from the Buddy system to construct Slab cache areas, wherein each Slab cache area comprises a management head and a plurality of index units with fixed sizes; When a resource request is received, searching and distributing available index units in a Slab cache region through a Slab distributor; When no index unit is available in the Slab cache region, calling the Buddy system to allocate a new continuous index region, and constructing a new Slab cache region based on the region; After releasing the index units, if all index units in the corresponding Slab cache region are released, returning the index region corresponding to the Slab cache region to the Buddy system, and judging whether the index region can be combined with the adjacent index region. In an alternative embodiment, linked lists of the Buddy system are managed in stages according to the size of an index section, each linked list corresponding to an index section of power of 2 size. In an alternative embodiment, the management header records the free index necklace table pointer, the usage status of the Slab, and the number of assigned index units. In an alternative embodiment, the method further comprises: When distributing index units, the Slab distributor directly takes out an available index unit from the idle linked list and updates the distributed count of the management head. In an alternative embodiment, when returning the index interval to the Buddy system, the method further comprises: and judging whether the index sections are adjacent to the adjacent Buddy sections and are in an idle state, if so, merging the index sections into a larger index section, and updating the linked list structure. In an alternative embodiment, the number and size of the Slab cache area are dynamically adjusted according to the resource usage when the system is running. In an alternative embodiment, the method is applied to management of MTT resources in an RDMA device, where the MTT resources are used to store mapping information of virtual addresses to physical addresses. In a second aspect, the present invention provides a resource management device based on a slot allocator in combination with a Buddy system, including: the first construction module is used for constructing a Buddy system consisting of a plurality of linked lists, wherein the linked lists are used for recording the starting position, the interval length and the use state of an index interval, and the index interval is divided according to the power of 2; A second construction module, configured to allocate consecutive index intervals from the Buddy system to construct slave cache areas, where each slave cache area includes a management header and a plurality of index units with fixed sizes; The searching module is used for searching and distributing available in