CN115658328A - Device and method for managing storage space, computing equipment and chip - Google Patents

Device and method for managing storage space, computing equipment and chip Download PDF

Info

Publication number
CN115658328A
CN115658328A CN202211561700.9A CN202211561700A CN115658328A CN 115658328 A CN115658328 A CN 115658328A CN 202211561700 A CN202211561700 A CN 202211561700A CN 115658328 A CN115658328 A CN 115658328A
Authority
CN
China
Prior art keywords
space
storage
index
storage unit
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211561700.9A
Other languages
Chinese (zh)
Other versions
CN115658328B (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Moore Threads Technology Co Ltd
Original Assignee
Moore Threads Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Moore Threads Technology Co Ltd filed Critical Moore Threads Technology Co Ltd
Priority to CN202211561700.9A priority Critical patent/CN115658328B/en
Publication of CN115658328A publication Critical patent/CN115658328A/en
Application granted granted Critical
Publication of CN115658328B publication Critical patent/CN115658328B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)

Abstract

The present disclosure provides an apparatus, computing device, method, and chip for managing storage space. The device comprises: a first interface configured to receive a space management request from an external request source; a second interface connected to a memory including a memory space; a local index store configured to: reading a storage unit index from a first storage area of the storage space via a second interface in response to the size of the remaining space thereof satisfying a first condition, and writing the storage unit index to the first storage area of the storage space via the second interface in response to the size of the remaining space thereof satisfying a second condition, each storage unit index representing a storage unit of a preset size in a second storage area of the storage space; a space management module configured to: the storage unit index in the local index storage is managed based on the space management request. This helps to reduce path delay, reduce access frequency to memory, and improve management efficiency.

Description

Device and method for managing storage space, computing equipment and chip
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an apparatus for managing a storage space, a computing device, a method for managing a storage space, and a chip.
Background
With the development of computer technology, more and more various computing devices appear in life, work and study of people. Generally, in these computing devices, there are various forms of processors, controllers, or microcontrollers that require a certain amount of space from memory when running an application to perform a certain function, and the corresponding space can be freed when the application has finished running. This involves managing the memory space.
At present, the management of the memory space is generally realized by a software manner, that is, a CPU (central processing Unit) or an MCU (micro controller Unit) runs a memory management policy, and sends an instruction, and then a hardware system processes the instruction, and then a bus is used to realize the read-write operation of the memory. In the memory management scheme implemented by software, the problems of long path, high delay, complex structure and the like generally exist.
Disclosure of Invention
In view of the above, the present disclosure provides an apparatus for managing memory space, a method for managing memory space, a computing device and a chip, which may alleviate, alleviate or even eliminate the above-mentioned problems.
According to an aspect of the present disclosure, there is provided an apparatus for managing a storage space, including: a first interface connected to an external request source and configured to receive a space management request from the external request source; the second interface is connected with a memory, and the memory comprises a memory space; a local index store configured to: reading, via the second interface, a storage unit index from the first storage area of the storage space in response to the size of the remaining space of the local index storage satisfying a first condition, and writing, via the second interface, a storage unit index to the first storage area of the storage space in response to the size of the remaining space of the local index storage satisfying a second condition, wherein each storage unit index is used for representing a storage unit with a preset size in the second storage area of the storage space; a space management module configured to: the storage unit index in the local index storage is managed based on the space management request.
In some embodiments, in response to the size of the remaining space of the local index storage satisfying the first condition, reading, via the second interface, the storage unit index from the first storage area of the storage space comprises: when the remaining space of the local index storage is larger than a first threshold value and an index writing request from the space management module is not received, reading a first preset number of storage unit indexes from a first storage area of the storage space through a second interface.
In some embodiments, in response to the size of the remaining space of the local index storage satisfying the first condition, reading, via the second interface, the storage unit index from the first storage area of the storage space further comprises: when the remaining space of the local index storage is larger than a first threshold value, in response to receiving an index write request from the space management module, preferentially writing a storage unit index associated with the index write request.
In some embodiments, a ratio of the first predetermined amount to the remaining space of the local index storage is greater than 0 and less than 1.
In some embodiments, in response to the size of the remaining space of the local index storage satisfying the second condition, writing, via the second interface, the storage unit index to the first storage area of the storage space comprises: and when the residual space of the local index memory is smaller than a second threshold value and an index reading request from the space management module is not received, writing a second preset number of storage unit indexes into the first storage area of the storage space through the second interface.
In some embodiments, in response to the size of the remaining space of the local index storage satisfying the second condition, writing, via the second interface, the storage unit index to the first storage area of the storage space comprises: when the remaining space of the local index storage is smaller than the second threshold, in response to receiving an index read request from the space management module, preferentially reading the storage unit index associated with the index read request.
In some embodiments, a ratio of the second predetermined number to a footprint of the local index storage is greater than 0 and less than 1.
In some embodiments, the local index storage is further configured to maintain a first pointer and a second pointer, said reading the storage unit index from the first storage area of the storage space via the second interface comprises: reading, via the second interface, the storage unit index from the first storage area according to the position pointed to by the first pointer, and writing, via the second interface, the storage unit index to the first storage area of the storage space includes: and writing the storage unit index into the first storage area according to the position pointed by the second pointer through the second interface.
In some embodiments, the space management request comprises a space allocation request, the space management module comprises a space allocation module configured to: feeding back a completion signal in response to the allocation of the memory cell index associated with the space allocation request being completed; reading one or more storage unit indexes from the local index storage in response to the storage unit indexes related to the space allocation request not being allocated and the local index storage being not empty; and responding to the condition that the storage unit index related to the space allocation request is not allocated completely and the local index memory is empty, and waiting until the local index memory is not empty.
In some embodiments, the space allocation module includes at least two sub-allocation modules, each sub-allocation module corresponding to one of a set of preset sizes and configured to receive sub-allocation requests corresponding to the respective preset sizes.
In some embodiments, the space management request comprises a space reclamation request, the space management module comprises a space reclamation module configured to: feeding back a completion signal in response to the storage unit index related to the space reclamation request being reclaimed; writing one or more storage unit indexes into the local index storage in response to the storage unit indexes related to the space recycling request not being recycled and the local index storage being not full; and in response to the storage unit index related to the space reclamation request not being completely reclaimed and the local index storage being full, waiting until the local index storage is not full.
In some embodiments, the space reclamation module includes at least two sub-reclamation modules, each sub-reclamation module corresponding to one of a set of preset sizes and configured to receive sub-reclamation requests corresponding to the respective preset sizes.
In some embodiments, the local index store comprises at least two sub-index stores, each sub-index store corresponding to one of a set of preset sizes and configured to: the method further includes reading a memory cell index from a sub-region of the first memory region via the second interface, and writing the memory cell index to the sub-region of the first memory region via the second interface.
In some embodiments, the apparatus further comprises a request classification module configured to: in response to receiving the space allocation request, splitting the space allocation request into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request corresponds to one preset size in a preset size set; in response to receiving the space recovery request, the space recovery request is split into one or more sub-recovery requests according to the storage unit index corresponding to the space requested to be recovered by the space recovery request, wherein each sub-recovery request corresponds to one preset size in the preset size set.
In some embodiments, the above apparatus further comprises: an initialization module configured to: after the device is powered on, writing a plurality of storage unit indexes in the first storage area of the storage space and/or the local index storage via the second interface.
In some embodiments, the space management module comprises an index generation module configured to generate the storage unit index according to a preset rule, and wherein the space management module is configured to: in response to the space management request being a space allocation request and the allocated number of storage unit indexes being below a threshold number, causing the index generation module to generate one or more storage unit indexes, the allocated number of storage unit indexes being a cumulative number of storage unit indexes allocated to the external request source.
According to another aspect of the present disclosure, there is provided a computing device comprising the apparatus for managing storage space described according to the preceding aspect.
According to still another aspect of the present disclosure, there is provided a method for managing a storage space, including: receiving a space management request from an external request source; reading storage unit indexes from a first storage area of a storage space in response to the size of the residual space of the local index storage meeting a first condition, wherein each storage unit index is used for representing a storage unit with a preset size in a second storage area of the storage space; writing a storage unit index into a first storage area of the storage space in response to the size of the remaining space of the local index storage satisfying a second condition; the storage unit index in the local index storage is managed based on the space management request.
According to yet another aspect of the present disclosure, there is provided a chip comprising the apparatus for managing storage space described in accordance with various embodiments of the foregoing aspects.
The apparatus for managing storage space provided by the present disclosure may receive a space management request from an external request source, and manage storage unit indexes in a local index storage based on the space management request, for example, allocate the storage unit indexes in the local index storage, or recycle the storage unit indexes to the local index storage to complete allocation or recycling of corresponding storage units, where the local index storage may read or write the storage unit indexes from or to the storage when the remaining space satisfies a preset condition, so as to keep the number of storage unit indexes in the local index storage or the amount of remaining space floating within a preset range, so as to satisfy the requirement of normal space management. Therefore, the allocation and recovery of the storage space in the memory can be efficiently managed through the hardware device based on the request of the request source such as the CPU, the MCU and the like, and the problems of long path, high delay and the like caused by a software mode can be reduced, so that the management efficiency of the storage space is improved, and the running speed of the whole computing system is improved. Meanwhile, the resources of the processor, the controller or the microcontroller can be released by implementing memory management by virtue of a single hardware device, and the resources are optimized and configured, so that the overall performance of the computing system is improved. In addition, the device for managing storage space stores the unit index in the local cache part, so that management related to a small number of storage unit indexes can be realized only through interaction with a local index memory without accessing an external memory, which is beneficial to shortening the read-write path of the storage unit indexes, reducing the read-write time, and allowing the memory to be accessed only when necessary, thereby reducing frequent interaction between the device and the memory, reducing the read-write access frequency of the memory, reducing the occupation duration of the read-write bandwidth of the memory, further being beneficial to reducing path delay in the space management process, and being beneficial to improving the space management efficiency and the overall system operation efficiency.
These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter.
Drawings
Further details, features and advantages of the disclosure are disclosed in the following description of exemplary embodiments, taken in conjunction with the accompanying drawings, in which:
fig. 1 is a schematic diagram illustrating a memory management architecture in the related art;
2A, 2B, 2C, 2D, 2E schematically illustrate example block diagrams of a storage management system according to some embodiments of this disclosure;
FIGS. 3A and 3B schematically illustrate partitioning schemes of a memory space according to some embodiments of the present disclosure;
FIG. 4 schematically illustrates an example scenario for managing storage unit indexes with a first pointer and a second pointer;
FIG. 5 schematically illustrates an example architecture of a local index store, in accordance with some embodiments of the present disclosure;
FIG. 6 schematically illustrates an example state machine of the space allocation module, in accordance with some embodiments of the present disclosure;
FIG. 7 schematically illustrates an example state machine of a space reclamation module in accordance with some embodiments of the present disclosure;
FIG. 8 schematically illustrates an example block diagram of a request classification module in accordance with some embodiments of this disclosure;
fig. 9 schematically illustrates another example block diagram of the internal structure of a space allocation module in accordance with some embodiments of this disclosure;
fig. 10 schematically illustrates an example block diagram of a computing device in accordance with some embodiments of this disclosure;
FIG. 11 schematically illustrates an example flow diagram of a method for managing storage space, in accordance with some embodiments of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure. It is to be understood that the described embodiments are merely a few embodiments of the disclosure, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Fig. 1 is a schematic diagram illustrating a memory management architecture 100 in the related art. As shown in fig. 1, in the related art, the memory 110 may be directly managed by the processor 120 or the like via the bus 130. For example, when the processor 120 needs to write data into the memory space, the available space may be determined according to the memory space management policy stored inside, and then an instruction for writing data into the corresponding memory space is issued, which may be processed by hardware and sent to the memory 110 via the bus 130 to implement data writing. Data reading, deleting, etc. processes may be similarly implemented. However, the applicant has found that performing memory management in this way has the following disadvantages: firstly, the resources of the processor (or the controller, the microcontroller, etc.) need to be occupied to execute operations such as space allocation, recycling, etc., which is not favorable for the efficient utilization of the resources; secondly, the allocation and the recovery of the memory space are implemented through software, the instruction is processed by hardware, and then the read-write operation is carried out in the memory space through a bus, so that the method has the characteristics of long path, high delay, complex structure and the like; thirdly, the parallel operation of space recovery and space distribution is difficult to realize by managing the memory in a software mode, so that the improvement of the operation efficiency is limited; and so on.
In view of the above, the applicant has proposed a new solution for implementing memory management by hardware circuitry, which helps to solve or alleviate the above-mentioned various problems. According to the embodiment of the disclosure, the device for managing the storage space does not need to frequently access the memory to read and write the storage unit index, so that the occupied read-write bandwidth of the memory can be reduced, a large amount of time is not needed to be consumed for read-write access of the memory, and the space management efficiency and the overall system performance can be effectively improved.
Fig. 2A schematically illustrates an example block diagram of a storage management system 200A, according to some embodiments of this disclosure. The storage space management system 200 comprises means 210 for managing storage space, which may receive a space management request from an external request source 220 and process the received space management request to manage storage space in a storage 230. Illustratively, the memory 230 may be various memories used as a memory, such as a Double Data Rate (DDR) synchronous dynamic random access memory (sdram), etc., or may be other types of memories. Illustratively, the external request source 220 may be any device that can initiate a space management request, such as a CPU, GPU, MCU, or the like. Furthermore, although only one external request source is shown in the figures of the present disclosure, the apparatus 210 provided by the embodiments of the present disclosure may be used to receive and process space management requests from multiple external request sources according to specific application requirements.
As shown in fig. 2A, the apparatus 210 for managing storage space may include a first interface 211, a second interface 212, a local index storage 213, and a space management module 214. The first interface 211 may be connected to the external request source 220, for example, via a dedicated line or a common line (such as a bus), and is used for enabling communication between the external request source 220 and the apparatus 210, for example, data communication via a handshake. The first interface 211 may be configured to receive a space management request from the external request source 220, and may be configured to feed back a management result from the space management module to the external request source 220. The space management request may be a space allocation request or a space reclamation request, and the management result may be, for example, information indicating a storage unit index of the allocated space, a space allocation failure, a space reclamation success, or the like. The second interface 212 may be configured to be connected with the memory 230 and used to enable communication between the memory 230 and the apparatus 210, e.g., may send a read or write request from the apparatus 210 to the memory 230, receive read data from the memory 230, receive information indicating a write result from the memory 230, and the like.
In the present disclosure, space management may include both space allocation and space reclamation, where space allocation may be implemented by allocation of storage unit indexes and space reclamation may be implemented by reclamation of storage unit indexes. Further, the allocation of the storage unit index may be understood as a process of acquiring the storage unit index from the local index generation module or the memory by the space allocation module and feeding back to the external request source, and the reclamation of the storage unit index may be understood as a process of writing the storage unit index corresponding to the space requested to be reclaimed by the space reclamation request from the external request source to the memory by the space reclamation module. An external request source may initiate space allocation through a space allocation request and space reclamation through a space reclamation request. A space allocation request may refer to a request for requesting allocation of a certain amount of space for use, such as in memory 230, and a space reclamation request (or referred to as a space release request) may refer to a request for reclaiming (or requesting release) of used space, such as in memory 230.
The local index store 213 may be configured to: in response to the size of the remaining space of the local index storage 213 satisfying a first condition, a storage unit index is read from a first storage area of the storage space of the memory 230 via the second interface 212, and in response to the size of the remaining space of the local index storage 213 satisfying a second condition, the storage unit index is written to the first storage area of the storage space of the memory 230 via the second interface 212. Each of the storage unit indexes may be used to characterize a storage unit having a preset size in the second storage area of the storage space. Alternatively, the local index memory 213 may be a FIFO (First in First out) or other type of memory. The occupied space of the local index storage 213 may refer to a space currently occupied by storing the storage unit index, and the remaining space may refer to a space currently not occupied by the storage unit index among the spaces for accommodating the storage unit index. Illustratively, the size of the remaining space or footprint of the local index storage 213 may be represented by its actual size (e.g., in bytes, kilobytes, etc.) or by the number that can accommodate the storage unit index, or may be otherwise represented. Exemplarily, assuming that the local index storage 213 can accommodate a total of 218 storage unit indexes, and currently stores 100 storage unit indexes, its occupied space can be denoted as 100, and the remaining space can be denoted as 118.
Alternatively, the first condition and the second condition may be fixed, may be configurable by a user, or may be automatically determined by the apparatus according to a preset rule. Illustratively, the first condition may be defined by at least one of: the remaining space is greater than or equal to a certain value, the proportion of the remaining space to the total space is greater than or equal to a certain value, the remaining space is greater than the occupied space (or the sum, product, etc. of the occupied space and a certain value), etc. Alternatively, whether the remaining space satisfies the first condition may be determined by a condition satisfied by a difference between the total space and the remaining space, that is, may be determined by a condition satisfied by the occupied space. For example, assuming that the total space is 218 and the first condition is that the remaining space is greater than or equal to 118, whether the remaining space satisfies the first condition may also be determined by whether the occupied space is less than 100. And, exemplarily, the second condition may be defined in a similar manner, and the first condition may be defined in the same manner as or in a different manner from the second condition.
Alternatively, the number of cell indices read from the memory when the first condition is satisfied and the number of cell indices written to the memory when the second condition is satisfied may be fixed, may be user-configurable, or may be automatically determined by the apparatus according to a preset rule. Illustratively, the number of the read storage unit indexes may be determined by at least one of the following ways: a fixed preset value, a difference value between the number of storage unit indexes currently stored in the local index storage and the threshold number, a product or sum of the remaining space or the occupied space and a certain value, and the like. And, illustratively, the number of written cell indices may be determined in a similar manner, and the number of read cell indices and the number of written cell indices may be determined in the same or different manner.
Illustratively, reading a storage unit index from a first storage area of the storage space of the memory 230 via the second interface 212 may be implemented by initiating a read request to the memory 230 and receiving feedback data thereof, and writing a storage unit index to a first storage area of the storage space of the memory 230 via the second interface 212 may be implemented by initiating a write request to the memory 230 and sending data thereto.
The space management module 214 may be configured to: the storage unit index in the local index storage 213 is managed based on the space management request. Illustratively, the space management module 214 may read or write the storage unit index from or to the local index storage 213 based on the space management request to complete the allocation and reclamation of the corresponding storage units in the storage 230.
Illustratively, the storage space management device 210 may be implemented as various types of hardware circuits, e.g., formed as an integrated circuit, packaged as a chip structure, etc., so as to be used as desired, e.g., soldered at corresponding pins of a circuit board or plugged into corresponding sockets of a circuit board, etc.
By the device 210, the storage space of the memory 230 (e.g., an internal memory such as a DDR memory) can be managed in a hardware manner, so that disadvantages of a software management manner can be reduced, a more convenient management manner can be provided, the space management efficiency can be improved, processing resources of a main control unit such as a CPU or an MCU can be saved, the operating efficiency of the whole computing system can be improved, and the resource allocation of the whole computing system can be optimized. Meanwhile, by the storage space management means 210, the storage unit index is allowed to be stored locally in a part, and the storage unit index is written to or read from the storage 230 only when the locally stored storage unit index is excessive or insufficient. Thus, upon receiving a space management request, the storage unit index can be managed only by an operation of locally reading and writing the storage unit index without frequently accessing the memory 230. The method can reduce frequent interaction between the device and the memory, reduce read-write access frequency of the memory, reduce the occupied time of read-write bandwidth of the memory, and thereby contribute to reducing path delay in the space management process and improving the space management efficiency and the overall system operation efficiency.
According to some embodiments of the present disclosure, the local index storage 213 may read or write the cell index from or to a specific area of the memory by means of a pointer. Schematically, fig. 3A, 3B and 4 show a partitioning scheme of a storage space and a pointer-based storage unit index management scheme according to an embodiment of the present disclosure.
As shown in fig. 3A, the storage space 300 may include a first storage area 310 and a second storage area 320. Optionally, the storage space 300 may also include other storage areas 330 left for other uses. The second storage area 320 may be divided into a plurality of storage units, and each storage unit may have a preset size, which may be set according to specific requirements, for example, set to 4KB, or set to 2KB, 8KB, 16KB, 32 KB, and the like. The first storage area 310 may be written to a plurality of storage unit indices, each of which may characterize a storage unit in the second storage area 320. For example, when the size of the second storage area is 8 GB, assuming that it is divided into a plurality of storage units with 4KB granularity, it is possible to divide into 2097152 storage units in total, thereby requiring 2097152 storage unit indexes in total. Each storage unit index may be stored in 4 bytes (byte) in the first storage area, and the size of the first storage area may be 8 MB in the above example.
In some embodiments, the second storage area 320 may be divided into a plurality of storage units, wherein each storage unit has one of a set of preset sizes. The preset size set may be set according to specific requirements, and may be set to include one or more of 2MB, 512KB, 128KB, 64KB, 16KB, 4KB, for example, or may include other preset sizes. For example, when the size of the second storage region is 8 GB, assuming that 4 GB storage space is divided at 2MB granularity, 2 GB storage space is divided at 512KB granularity, 1 GB storage space is divided at 128KB granularity, 512 MB storage space is divided at 64KB granularity, 256 MB storage space is divided at 16KB granularity, and 256 MB storage space is divided at 4KB granularity, 2048 2MB storage units, 4096 512KB storage units, 8192 128KB storage units, 8192 64KB storage units, 16384 KB storage units, 65536 4KB storage units may be divided in total. If a 4-byte (byte) storage unit index is allocated to each storage unit, 8KB is required for storage of the storage unit index corresponding to 2MB storage units, 16KB is required for storage of the storage unit index corresponding to 512KB storage units, 32 KB is required for storage of the storage unit indexes corresponding to 8192 128KB storage units, 32 KB is required for storage of the storage unit index corresponding to 64KB storage units, 64KB is required for storage of the storage unit index corresponding to 16KB storage units, and 256 KB is required for storage of the storage unit index corresponding to 4KB storage units. Thus, in the above example, the size of the first storage region may be 408 KB. In such an embodiment, as shown in fig. 3B, the first memory region 310 may be divided into a plurality of sub-regions 311, 312, etc., and each sub-region may write only the memory cell index corresponding to the same preset size. Taking the above-mentioned example as an example, the first storage region may be divided into 6 sub-regions, and the sub-regions respectively store the storage unit indexes corresponding to the storage units of 2MB, 512KB, 128KB, 64KB, 16KB and 4 KB. Further, in such an embodiment, in order to identify the storage unit indexes corresponding to different preset sizes, an identifier indicating a preset size may be included in each storage unit index. For example, the storage unit index may be divided into an identifier part and a unit index part, the identifier part may be used to store an identifier indicating a preset size, and the unit index part may be used to store an index value of a storage unit having a corresponding preset size. Exemplarily, in the above-described example having 6 kinds of preset sizes of 2MB, 512KB, 128KB, 64KB, 16KB, 4KB and representing the memory cell indexes by 4 bytes, the preset size may be represented by the upper 3 bits for each memory cell index, for example, 4KB may be represented by 000, 16KB may be represented by 001, 64KB may be represented by 010, 128KB may be represented by 011, 512KB may be represented by 100, 2MB may be represented by 101, and the remaining 29 bits may represent a specific index value.
For example, the aforementioned apparatus 210 may include an index configuration register, which may be configured to configure the number of the one or more storage unit indexes and/or the size of the corresponding storage unit based on a user input, for example, the configured number of the one or more storage unit indexes may be stored based on the user input, and sent to the apparatus 210 after the apparatus is powered on, such as sent to the local index storage 213 and/or the space management module 214 therein, so as to allow the partition manner of the storage space to be flexibly adjusted according to specific requirements.
Based on the above space division scheme, assuming that there is no local index memory 213, taking as an example a request involving management of 2MB of memory space, in the example described above where the 8 GB space is entirely divided into 4KB memory cells, 512 memory cell indexes are required to be read/written in total; in the above-described example in which the 8 GB space is divided into six sizes of 2MB, 512KB, 128KB, 64KB, 16KB, and 4KB, it may be necessary to read/write 1 memory cell index corresponding to 2MB memory cells in total. Further exemplarily, in a case that the reading and writing of the storage unit index are completed through the bus, for the former, if the bus burst length is 128, 4 read/write requests need to be triggered in total; for the latter, the bus burst length may be set to 1 and 1 read/write request needs to be triggered altogether. Such a read/write process would occupy the read-write bandwidth of the memory on the one hand and would take much time on the other hand. Although dividing the storage space into a plurality of storage units of predetermined sizes can help to reduce the number of reads and writes and the time, the problem still cannot be solved completely, and the number of reads and writes and the time may still be higher when the number of the storage unit indexes involved is larger. In contrast, with the apparatus for managing storage space described in the embodiment of the present disclosure, for example, the apparatus 210 shown in fig. 2, a part of the storage unit index may be stored by the local index storage 213 for allocation/reclamation operation, which can effectively reduce frequent accesses to the storage, and shorten a read-write path in the storage unit index management process, thereby improving the efficiency of space management and improving the overall performance of the system.
Illustratively, FIG. 4 schematically illustrates an example scheme 400 for reading and writing a storage unit index in a first storage area or sub-area thereof by the local index store 213 via a set of first and second pointers. As shown in sub-diagram a, when the device is powered on, the first pointer and the second pointer may be initialized to point to the same location in the area 410, for example, both point to the minimum address of the area 410, or may point to other locations. As shown in sub-diagram B, when the local index memory requests the memory to read a memory cell index, a certain number of memory cell indexes from the region 410 may be read, at which time the first pointer will be shifted downward, e.g., to point to the location of the next memory cell index that may be read. As shown in sub-graph C, when the local index store requests a write to memory for a storage unit index, the corresponding storage unit index will be written to region 410, at which time the second pointer will be offset downward, e.g., pointing to the location of the next writable storage unit index. As shown in sub-diagram D, when the first pointer and/or the second pointer are/is shifted to the maximum address of the area 410, the area will wrap around to the starting position. The above description is merely exemplary, and the first pointer and the second pointer may also be offset with the reading and writing of the storage unit index in other ways. It should be understood that the region 410 shown in fig. 4 may be the region 310 shown in fig. 3A, or may also be the sub-regions 311, 312, etc. of the region 310 shown in fig. 3B. Furthermore, the apparatus 210 may further exemplarily include an address configuration register, which may be used to configure the start address and the end address (such as the minimum address and the maximum address described above) of the first storage region 310 or each sub-region 311, 312 thereof, etc. based on a user input, for example, store the start address and/or the end address based on the user input, and issue the stored start address and/or end address to the apparatus 210 (such as to the local index memory 213 therein) after the apparatus is powered on, so that the first pointer and the second pointer may be moved between the start address and the end address of the corresponding region, thereby allowing flexible configuration of each start address and end address according to specific requirements.
In embodiments where the storage unit index is read from and written to by pointers, the local index storage 213 may be configured to maintain the first and second pointers, for example, according to the embodiment described with reference to fig. 4. Thus, the memory cell index can be read as follows: reading, via the second interface 212, a storage location index from a first storage area in the memory 230 according to a location pointed to by the first pointer; and the storage unit index may be written by: via the second interface 212, the storage location index is written to the first storage area in the memory 230 according to the location pointed to by the second pointer.
In some embodiments, the trigger condition (i.e., the aforementioned first condition) for the local index storage 213 to read the storage unit index from the storage 230 may be: the remaining space of the local index storage 213 is greater than a first threshold. The trigger condition may be equivalent to: the occupied space of the local index storage 213 is smaller than or equal to the difference between the total space, which can be understood as the total amount of space in the local index storage 213 for accommodating the storage unit index, and the first threshold. The trigger condition (i.e., the aforementioned second condition) for the local index storage 213 to write the storage unit index into the storage 230 may be: the remaining space of the local index storage 213 is less than a second threshold. The trigger condition may be equivalent to: the footprint of the local index storage 213 is greater than or equal to the difference between the total space and the second threshold. In some embodiments, when the first condition is satisfied, the number of storage unit indexes read from the storage 230 by the local index storage 213 may be determined according to the size of the remaining space, for example, determined as the product of the remaining space and a preset value, which may be a value between 0 and 1; similarly, when the second condition is satisfied, the number of storage unit indexes written to the memory by the local index storage 213 may be determined according to the size of the occupied space, for example, determined as the product of the occupied space and a certain preset value, which may be a value between 0 and 1.
Exemplarily, assuming that the total space of the local index storage 213 can accommodate at most 128 storage unit indexes, it may be set that when the remaining space is less than 10, a write procedure to the storage 230 is initiated to write 2/3 of the storage unit indexes in the local index storage 213 to the storage 230, and when the remaining space is greater than 118, a read procedure to the storage 230 is initiated to read 2/3 of the storage unit indexes of the remaining space from the storage 230. It should be understood that the above first threshold 10, second threshold 118 and ratio 2/3 are only exemplary and can be flexibly set according to the actual application requirements.
By setting the first threshold and the second threshold, it is possible to easily determine when the storage unit index should be written into the storage and when the storage unit index should be read from the storage, thereby controlling the number of the storage unit indexes in the local index storage within a certain range to meet the allocation and reclamation requirements of the storage unit indexes. By setting the number of the written storage units to be proportional to the number of the storage unit indexes in the local storage, the number of the storage units to be written into the local storage can be conveniently determined, and the number of the storage unit indexes in the local storage can be quickly adjusted to be within a required range; similarly, by setting the number of read memory cells to be proportional to the remaining space in the local memory, it is possible to easily determine the number of memory cells to be read from the memory and quickly adjust the number of memory cell indexes in the local memory to be within a desired range.
Schematically, fig. 5 shows an example architecture of a local index store 213 according to some embodiments of the present disclosure. As shown in fig. 5, there are two write scenarios for the local index store 213, namely: based on the reclamation writing of the space reclamation request, memory writing when the remaining space of the local index memory 213 satisfies a first condition and issues a read request for the storage unit index to the memory; and, there are two read-out scenarios for local index store 213, namely: the memory read-out when the remaining space of the local index memory 213 satisfies the second condition and a write request for the memory cell index is issued to the memory based on the allocation read-out of the space allocation request. Alternatively, when the above-mentioned evicted write conflicts with the memory write, the evicted write may be prioritized; when the above-described allocation read and memory read conflict, the read can be preferentially allocated. By preferentially reclaiming writes and allocating reads, space management operations can be prioritized and the read-write frequency for the memory is further reduced.
Thus, for example, the above-mentioned reading, via the second interface, the storage unit index from the first storage area of the storage space in response to the size of the remaining space of the local index storage satisfying the first condition may include: when the remaining space of the local index storage is larger than a first threshold value and an index writing request from the space management module is not received, reading a first preset number of storage unit indexes from a first storage area of the storage space through a second interface. And, it may further include: when the remaining space of the local index storage is larger than a first threshold value, in response to receiving an index write request from the space management module, preferentially writing the index of the storage unit related to the index write request. It is understood that when the remaining space of the local index storage is greater than the first threshold but an index write request from the space management module is received, if the index write request is executed, the remaining space of the local index storage may no longer be greater than the first threshold, that is, the operation of writing the index from the storage unit to the storage unit may not be executed; if the storage unit is preferentially read from the memory and written into the local index memory, it may be caused that, after the storage unit index related to the index writing request is subsequently written into the local index memory, the remaining space of the local index memory is lower than the second threshold, and the storage unit index needs to be written into the memory. Therefore, when the two conflict, the storage unit index related to the index writing request is written preferentially, so that the interaction frequency with the memory is reduced, and the number of times of reading or writing the storage unit index from or into the memory and the index amount are reduced. Further, the condition that the remaining space of the local index storage is greater than the first threshold may be understood as that the current remaining space of the local index storage is greater than the first threshold and that there is currently no potential factor that reduces its remaining space.
Similarly, illustratively, the writing the storage unit index to the first storage area of the storage space via the second interface in response to the size of the remaining space of the local index storage satisfying the second condition may include: and when the residual space of the local index memory is smaller than a second threshold value and an index reading request from the space management module is not received, writing a second preset number of storage unit indexes into the first storage area of the storage space through the second interface. And, it may further include: when the remaining space of the local index storage is smaller than the second threshold, in response to receiving an index read request from the space management module, preferentially reading the storage unit index associated with the index read request. It is understood that when the remaining space of the local index storage is smaller than the second threshold but an index reading request from the space management module is received, if the index reading request is executed, the remaining space of the local index storage may no longer be smaller than the second threshold, that is, the operation of writing the storage unit index into the storage may not be executed; if the storage unit is preferentially written into the memory, it may cause that, after the storage unit index related to the index reading request is read, the remaining space of the local index memory is higher than the first threshold, and the storage unit index needs to be read from the memory. Thus, when the two conflict, the priority reading of the memory cell index related to the index reading request can reduce the frequency of interaction with the memory, and the number of times of reading or writing the memory cell index from or into the memory and the amount of the index can be reduced. Further, the condition that the remaining space of the local index storage is smaller than the second threshold may be understood as that the current remaining space of the local index storage is smaller than the second threshold and that there is no potential factor for increasing the remaining space thereof.
Fig. 2B schematically illustrates an example block diagram of a storage management system 200B, in accordance with some embodiments of this disclosure. As shown, the space management module 214 may further include a space allocation module 2141 and a space reclamation module 2142.
More specifically, in some embodiments, as mentioned previously, the space management request may include a space allocation request and, accordingly, the space management module 214 may include the space allocation module 2141. The space allocation module 2141 may be configured to: feeding back a completion signal in response to the allocation of the memory cell index associated with the space allocation request being completed; in response to the storage unit index associated with the space allocation request not being allocated and the local index store being non-empty, reading one or more storage unit indices from the local index store 213; in response to the storage unit index associated with the space allocation request not being allocated and the local index store 213 being empty, wait until the local index store 213 is not empty. Through the above-described procedure, an operation of reading the storage unit index from the local index storage 213 based on the space allocation request to complete the allocation of the corresponding storage unit can be realized. For example, the space allocation request may request a certain amount of space, which may correspond to a number of storage units having a preset size, i.e., to a number of storage unit indexes. The storage unit index associated with the space allocation request is allocated completely, which may mean that the storage unit indexes are obtained from the local index storage and fed back to the external request source. Alternatively, the operation of feeding back the index of the storage unit to the external request source may be performed together with the feedback completion signal, or may be performed separately.
Exemplarily, fig. 6 schematically illustrates an example state machine 600 of the space allocation module 2141 according to some embodiments of the present disclosure.
As shown in fig. 6, when a space allocation request is not received, the space allocation module may be in an IDLE state, i.e., an IDLE state. When a space allocation request is received, whether the allocation of the memory cell index requested to be allocated by the space allocation request is completed or not can be judged, if yes, a completion (DONE) signal is fed back to the upper-stage circuit module, and the IDLE state is jumped back, and if not, the local index memory is jumped to be judged whether to be empty or not. Alternatively, in the example shown in fig. 6, the local index memory is shown as a FIFO type memory. And jumping to a waiting state if the FIFO is empty, and jumping to a state of reading the storage unit index from the FIFO if the FIFO is not empty. In the wait state, a preset amount of time may be waited, followed by a jump to determine if the allocation is complete and to determine if the FIFO is empty. Alternatively, the preset amount of time for the wait state may be a fixed value, a configurable value, or an adaptively adjustable value. For example, the preset amount of time may be determined according to one or more of a total space of the local index storage, a number of the local index storage reading the storage unit index from the storage at one time, a data transmission delay between the storage space management device and the storage, and the like. For example, in the foregoing example, if the capacity of the local index storage is 128 cell indexes, and the number of cell indexes read from the storage at a time is 2/3 of the remaining space, the predetermined amount of time may be approximately 128 × 2/3 + data transmission delay (e.g., bus delay). In a state where the cell index is read from the FIFO, the cell index may be read from the local index storage (i.e., the FIFO in this example). Illustratively, one cell index may be read and counted at a time, and then a jump is made to determine whether allocation is complete and the FIFO is empty until the required number of cell indices have been read.
In some embodiments, as mentioned previously, the space management request may comprise a space reclamation request and, accordingly, the space management module 214 may comprise a space reclamation module 2142. The space reclamation module 2142 may be configured to: feeding back a completion signal in response to the storage unit index related to the space reclamation request being reclaimed; in response to that the storage unit indexes related to the space recycling request are not recycled and the local index storage is not full, writing one or more storage unit indexes into the local index storage; and in response to the storage unit index related to the space reclamation request not being completely reclaimed and the local index storage being full, waiting until the local index storage is not full. Through the above-described procedure, an operation of writing the storage unit index to the local index storage 213 based on the space reclamation request to complete reclamation of the corresponding storage unit can be realized. For example, the space reclamation request may request to reclaim a partial space, which may correspond to a number of storage units having a preset size, i.e., to a number of storage unit indexes. The completion of the reclamation of the storage unit index associated with the space reclamation request may refer to the writing of the number of storage unit indexes, which are requested to be reclaimed by the external request source, into the local index storage. Optionally, after the storage unit index is completely written, a completion signal may be fed back to the external request source to indicate that the recycling is completed.
Exemplarily, fig. 7 schematically illustrates an example state machine 700 of a space reclamation module 2142 according to some embodiments of the present disclosure.
As shown in fig. 7, when a space reclamation request is not received, the space reclamation module may be in an IDLE state, i.e., an IDLE state. When a space recovery request is received, whether the storage unit index requested to be recovered by the space recovery request is completely recovered or not can be judged, if yes, a DONE (DONE) signal is fed back to an upper-stage circuit module, and an IDLE state is jumped back, and if not, whether a local index memory is full or not is judged. Alternatively, in the example shown in fig. 7, the local index memory is shown as a FIFO type memory. And if the FIFO is full, jumping to a waiting state, and if the FIFO is not full, jumping to a state of writing the storage unit index into the FIFO. In the wait state, a preset amount of time may be waited, followed by a jump to determine whether reclamation is complete and whether the FIFO is full. Alternatively, the preset amount of time for the wait state may be a fixed value, a configurable value, or an adaptively adjustable value. For example, the preset amount of time may be determined according to one or more of the total space of the local index storage, the number of the local index storage writing the storage unit index to the storage at one time, the data transmission delay between the storage space management device and the storage, and the like. For example, in the foregoing example, if the capacity of the local index storage is 128 cell indexes, and the number of cell indexes that are written into the storage at one time is 2/3 of the remaining space, the preset amount of time may be approximately 128 × 2/3) + the data transmission delay (e.g., bus delay). In a state of writing the memory cell index to the FIFO, the memory cell index may be written to the local index storage (i.e., the FIFO in this example). Illustratively, one memory cell index can be written and counted each time, and then a jump is made to determine whether reclamation is complete and the FIFO is full until all memory cell indexes are written.
Fig. 2C schematically illustrates an example block diagram of a storage management system 200C, in accordance with some embodiments of this disclosure. As shown, the storage space management system 200C may further include one or more of a request classification module 215, a bus 216, and an initialization module 217, as compared to the storage space management systems 200A, 200B shown in fig. 2A, 2B.
Illustratively, as shown in fig. 8, the request classification module 215 may be provided with a first queue 2151 and a second queue 2152, and configured to: a space management request is received and stored to the first queue 2151 when the space management request is a space allocation request, and to the second queue 2152 when the space management request is a space reclamation request. Thus, space management requests from external request sources may be sorted for storage, such that space allocation requests and space reclamation requests may be simultaneously passed to subsequent modules, such as the aforementioned space allocation module 2141 and space reclamation module 2142, thereby facilitating parallel processing of space allocation requests and space reclamation requests. In addition, the first queue 2151 and the second queue 2152 may store the received space allocation request and space reclamation request, so that when an external request source initiates multiple requests, the back pressure to the external request source may be reduced, and the system efficiency may be improved. Alternatively, the first queue 2151 and the second queue 2152 may take the form of a storage structure such as a FIFO. Due to the limited FIFO memory space, pre-full thresholds may be set for the first queue 2151 and the second queue 2152. When the number of space allocation requests stored in the first queue 2151 reaches a respective pre-full threshold (or first threshold), the first queue 2151 may perform pre-full backpressure, and may no longer receive space allocation requests from external request sources; when the number of space reclamation requests stored in the second queue 2152 reaches a corresponding pre-full threshold (or referred to as a second threshold), the second queue 2152 may perform a pre-full backpressure and may no longer receive space reclamation requests from external request sources. By means of the backpressure mechanism, the request classification module 215 can be prevented from receiving space allocation requests and/or space reclamation requests exceeding the storage capacity thereof, thereby reducing the probability of processing errors.
Illustratively, the bus 216 may be connected with the local index storage 213 and other modules (such as the initialization module 217 shown in fig. 2C) so that these modules can interact with the memory 230 via a second interface (not shown) of the apparatus 210. Bus 216 may illustratively be a standard NOC (Network on Chip) bus, or may be implemented using other types of buses. Further, bus 216 may optionally connect other modules related or unrelated to the various modules described in this disclosure.
Illustratively, the initialization module 217 may be configured to: after the device 210 is powered on, a plurality of storage unit indexes are written in the first storage area of the storage space of the memory 230 and/or the local index storage via the second interface thereof. For example, after the hardware circuit is powered on and reset, the initialization module 217 may first write the storage unit index into the first storage area of the memory 230, as described above, the first storage area may be a pre-specified area, and the size and the position of the first storage area may be adjusted as needed; alternatively, for example, the initialization module 217 may write part of the cell indexes into the local index storage 213 and write the rest of the cell indexes into the first storage area of the memory 230; and so on. When all storage unit index writes are complete, the device 210 may begin responding to space management requests from the external request source 220, and thereafter the initialization module 217 may cease functioning until the hardware circuitry is powered down and is started up again after the next power up. For example, after the initialization module 217 completes the index write operation, a signal may be sent to a previous stage (e.g., the request sorting module 215 described above or other circuit modules) to inform the previous stage that the space management request may begin to be received.
Fig. 2D schematically illustrates an example block diagram of a storage space management system 200D, in accordance with some embodiments of this disclosure. As shown in fig. 2D, compared to the memory space management system 200C shown in fig. 2C, in the memory space management system 200D, the initialization module 217 may be replaced by an index generation module 218.
For example, the index generation module 218 may be configured to generate the storage unit index according to a preset rule. Accordingly, the space allocation module 2141 may be configured to: in response to receiving the space allocation request and the allocated number of storage unit indices being below the threshold number of storage unit indices, the index generation module 218 is caused to generate one or more storage unit indices. And, optionally, the space allocation module 2142 may be further configured to: in response to a sum of the allocated number of storage unit indices and the to-be-allocated number of storage unit indices being greater than a threshold number, at least one storage unit index is read from a first storage area of the storage space of the memory 230 via the second interface. The amount to be allocated of the memory unit index may be determined based on the size of the space requested to be allocated by the received space allocation request, for example, assuming that the memory space is divided into 4KB memory units and the space requested to be allocated by the space allocation request is 64KB, the amount to be allocated may be determined as 16. The threshold number of storage unit indices may be a default value or a configurable value, which may be less than or equal to the total number of storage unit indices. The total number of storage unit indexes and the number of storage units having a preset size in the second storage area may be corresponding, e.g., equal. The allocated amount of a storage unit index may be understood as the cumulative amount of storage unit indexes allocated to the external request source 220. For example, assuming that m space allocation requests are received in an accumulated manner after the device is powered on, and n space allocation requests are successfully allocated, the sum of the numbers of allocated storage unit indexes for the n space allocation requests may be regarded as the allocated number of storage unit indexes. Therefore, the local index generation module can gradually generate the storage unit indexes according to the preset rule in the space allocation process and directly use the storage unit indexes for allocation, and then gradually write the generated and allocated storage unit indexes into the corresponding areas of the storage space in the memory along with the space recycling process. Compared with the embodiment of the initialization module 217 shown in fig. 2C, the initialization speed after the device is powered on can be effectively increased by using the index generation module 218, so as to avoid monopolizing the write bandwidth of the memory when the indexes of the memory cells are intensively written, thereby contributing to increasing the overall efficiency of the memory space management system.
Fig. 2E schematically illustrates an example block diagram of a storage management system 200E, in accordance with some embodiments of the present disclosure. As mentioned above, the storage space in the memory 230 may be divided into storage units having different preset sizes, so that there may be storage unit indexes corresponding to the different preset sizes. In such an embodiment, in order to more conveniently manage the unit indexes corresponding to different preset sizes, as shown in FIG. 2E, the local index storage 213 may include at least two sub index storages 213-1 to 213-N, where N may be an integer greater than zero and may be equal to the number of preset sizes in the preset size set. Each sub-index store of index stores 213-1 through 213-N may correspond to one of a set of preset sizes and is configured to: the memory cell index is read from a sub-region of a first memory region of the memory space in the memory 230 via the second interface 212 and written to the sub-region of the first memory region via the second interface 212. Illustratively, in the example described above in which the storage space is divided into six preset-sized storage units of 2MB, 512KB, 128KB, 64KB, 16KB and 4KB, six sub-index memories 213-1 to 213-6 may be provided, corresponding to the preset sizes of 2MB, 512KB, 128KB, 64KB, 16KB and 4KB, respectively, and used for storing the storage unit indexes corresponding to the respective preset sizes, respectively.
In the example shown in fig. 2E, the space allocation module 2141 may include at least two sub allocation modules 2141-1 to 2141-N, each of which may correspond to one preset size of a preset size set and is configured to receive a sub allocation request corresponding to the corresponding preset size. Similarly, the space recycling module 2142 may include at least two sub-recycling modules 2142-1 to 2142-N, each corresponding to one of a set of preset sizes, and configured to receive sub-recycling requests corresponding to the respective preset sizes. For example, each sub-allocation module and each sub-reclamation module may interact with a sub-index storage corresponding to the same preset size to read or write the cell index therefrom or to the cell index thereto. The operations of the sub-allocation module, the sub-recovery module and the sub-index memory corresponding to the same preset size are similar to those of the space allocation module, the space recovery module and the multi-index memory described above, and are not repeated herein.
In the embodiment shown in fig. 2E, a request classification module 215 and/or other circuit modules similar to those shown in fig. 2C and 2D may be provided and may be configured to receive the space management request, classify the space management request into a space allocation request and a space reclamation request, and pre-process the space allocation request and the space reclamation request. Illustratively, the preprocessing process may include: in response to receiving the space allocation request, splitting the space allocation request into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request corresponds to one preset size in a preset size set; in response to receiving the space recovery request, the space recovery request is split into one or more sub-recovery requests according to the storage unit index corresponding to the space requested to be recovered by the space recovery request, wherein each sub-recovery request corresponds to one preset size in the preset size set. The split sub-allocation request or requests may be passed to the space allocation module 2141 and processed by the respective sub-allocation module; the split one or more child reclamation requests may be passed to the space reclamation module 2142 and processed by the respective child reclamation modules.
For example, for a space allocation request, the request classification module 215 and/or other circuit modules may receive a space allocation request, and split the space requested to be allocated by the space allocation request based on a preset size in a preset size set, so that the space requested to be allocated may be split into one or more storage units having the same or different preset sizes, thereby splitting the space allocation request into one or more sub-allocation requests, where each sub-allocation request may be used to request allocation of a storage unit index of a preset size. Optionally, if the received space allocation request cannot be completely split into a combination of preset sizes in the preset size set, an error may be reported to the upper level circuit module; if the split sub-allocation request can be completely split, the split sub-allocation request can be transmitted to the space allocation module 2141 and processed by each sub-allocation module, each sub-allocation module can feed back a completion signal after processing is completed, and the request classification module 215 and/or other circuit modules can continue to process other space allocation requests after receiving the completion signals from all sub-allocation modules. Illustratively, taking the example of dividing the storage space with the granularity of 2MB, 512KB, 128KB, 64KB, 16KB and 4KB described above as an example, it may be determined whether the space requested to be allocated by the space allocation request satisfies the rule of a × 2MB + B × 512KB + C × 128KB + D × 64KB + E × 169b + F × 4KB, where a, B, C, D, E and F are integers greater than or equal to zero. If the request is satisfied, the space allocation request may be considered to be completely split, and if the request is not satisfied, the space allocation request may be considered not to be completely split. In the case of incomplete splitting, information indicating an error may be reported. In the case of full split, A, B, C, D, E, F represent the required number of memory cells per predetermined size. Optionally, when the space allocation request is split, in order to further reduce the number of storage unit indexes that need to be read and improve reading efficiency, the number of the split storage units may be minimized as much as possible. For example, in the above example, the value of a + B + C + D + E + F may be minimized.
For example, for a space reclamation request, the space reclamation request may include therein an index of a storage unit to be reclaimed or data from which the index of the storage unit to be reclaimed is derived. Therefore, the preset size corresponding to each storage unit index to be recovered can be determined according to an identifier indicating the preset size in the storage unit index to be recovered or the numerical range of the storage unit index to be recovered, and the preset size is divided into a plurality of sub-recovery requests based on the preset size and transmitted to the corresponding sub-recovery modules in the space recovery module for processing. Similarly, each sub-reclamation module may feed back a completion signal after processing is completed, and the request classification module 215 and/or other circuit modules may continue to process other space reclamation requests after receiving completion signals from all sub-reclamation modules.
To further facilitate understanding, fig. 9 schematically illustrates an example block diagram of a partial internal structure of the space allocation module 210 according to an embodiment in which the storage space is divided into a plurality of storage units of a preset size, according to some embodiments of the present disclosure.
As shown in fig. 9, the sub-allocation module, the sub-recycle module, and the sub-index memory corresponding to the same preset size can be regarded as a group of modules, wherein the sub-allocation module receives an allocation request of a memory cell index of a corresponding preset size, reads the memory cell index from the sub-index memory based on the request, receives a recycle request of the memory cell index of the corresponding preset size at the end of sub-recycle, writes the memory cell index into the sub-index memory based on the request, and the sub-index memory stores a part of the memory cell index of the corresponding preset size, and reads or writes the memory cell index from or into a corresponding sub-area of the first memory area of the memory via the bus 216 or in other manners as needed according to the threshold mechanism described above. Thus, the group of modules can complete the management of the storage unit indexes with corresponding preset sizes. Two or more such modules may implement management of multiple preset sizes of storage unit indices and, in turn, complete processing of various space management requests in coordination with prior-level circuit modules, such as the request classification module described above.
Fig. 10 schematically illustrates an example block diagram of a computing device 1000 in accordance with some embodiments of this disclosure. In some embodiments of the present disclosure, there is also provided a computing device that may include the apparatus for managing storage space described above, such as the apparatus 210A-200E. Schematically, fig. 10 shows an example block diagram of a computing device 1000. As shown, computing device 1000 may include means 1010 for managing storage, which may perform storage management functions as described in the various embodiments above. Computing device 1000 may also include a processor or controller 1020, which may be implemented as a CPU, MCU or similar structure and may be used to perform various processing or control operations. Computing device 1000 can also include a memory 1030 that can be used to store data, such as various program data needed by processor or controller 1020 in executing applications or data used or generated in the course of executing applications, etc. The memory 1030 is implemented, for example, as a single memory, or may be implemented as a combination of two or more memories. For example, memory 1030 may include one or more internal memories, such as DDR memory or SDRAM memory, etc., used as memory. The means for managing storage 1010, the processor/controller 1020, and the memory 1030 may be coupled together via a communication line 1040 and may enable data transfer therebetween. Illustratively, the communication lines 1040 may be buses (such as AXI buses or the like) or other types of communication lines, or may be a combination thereof.
The present disclosure also provides a method for managing storage space, illustratively, figure 11 is an example flow diagram of a method 1100 for managing storage space according to some embodiments of the present disclosure.
As shown in FIG. 11, at step 1110, a space management request from an external request source may be received; in step 1120, in response to that the size of the remaining space of the local index storage satisfies a first condition, the storage unit indexes may be read from a first storage area of the storage space, wherein each storage unit index is used for representing a storage unit with a preset size in a second storage area of the storage space; in step 1130, in response to the size of the remaining space of the local index storage satisfying the second condition, a storage unit index may be written to the first storage area of the storage space; in step 1140, the storage unit index in the local index store may be managed based on the space management request.
The method 1200 may have the same or similar embodiments and may have the same or similar technical effects as the aforementioned apparatus for managing storage space. For the sake of brevity, further description is omitted herein. Further, it should be understood that while fig. 11 shows steps 1110 through 1140 in a sequential order, these steps need not be performed in the order shown, wherein some of the steps may be performed in parallel or in a different order than shown.
In some embodiments of the present disclosure, there is also provided a chip that may include the apparatus for managing storage space described in the foregoing various embodiments. Illustratively, the chip may be connected to a request source such as a CPU, an MCU, etc. and a memory such as a DDR, etc. through a bus or other means, and manage the memory cell index according to the space management request of the request source based on the various embodiments described above, thereby implementing management of the memory space in the memory. Optionally, the chip may comprise circuit modules or means for performing other functions in addition to the means for managing memory space described above.
In the description of the present disclosure, the terms "upper", "lower", "left", "right", and the like indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of describing the present disclosure but do not require that the present disclosure must be constructed and operated in a specific orientation, and thus, cannot be construed as limiting the present disclosure.
In the description herein, references to the description of "one embodiment," "another embodiment," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment is included in at least one embodiment of the disclosure. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction. In addition, it should be noted that the terms "first" and "second" in this specification are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present disclosure, "a plurality" means two or more unless specifically limited otherwise.
In the present disclosure, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integral; the connection can be mechanical connection, electrical connection or communication; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meaning of the above terms in the present disclosure can be understood by those of ordinary skill in the art as appropriate.
The above description is only a specific embodiment of the present disclosure, but the scope of the present disclosure is not limited thereto. Any changes or substitutions that may be easily conceived by a person skilled in the art within the technical scope of the present disclosure are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (19)

1. An apparatus for managing storage space, comprising:
a first interface connected to an external request source and configured to receive a space management request from the external request source;
the second interface is connected with a memory, and the memory comprises the storage space;
a local index store configured to: reading a storage unit index from a first storage area of the storage space via the second interface in response to the remaining space of the local index storage satisfying a first condition, and writing a storage unit index to the first storage area of the storage space via the second interface in response to the size of the remaining space of the local index storage satisfying a second condition, wherein each storage unit index is used for representing a storage unit with a preset size in a second storage area of the storage space;
a space management module configured to: managing the storage unit index in the local index storage based on the space management request.
2. The apparatus of claim 1, wherein the reading, via the second interface, a storage unit index from a first storage area of the storage space in response to a size of remaining space of the local index storage satisfying a first condition comprises:
when the remaining space of the local index memory is larger than a first threshold value and an index writing request from the space management module is not received, reading a first preset number of storage unit indexes from a first storage area of the storage space through the second interface.
3. The apparatus of claim 2, wherein the reading, via the second interface, a storage unit index from a first storage area of the storage space in response to a size of remaining space of the local index storage satisfying a first condition further comprises:
when the residual space of the local index memory is larger than a first threshold value, in response to receiving an index writing request from the space management module, preferentially writing a storage unit index related to the index writing request.
4. The apparatus of claim 2, wherein a ratio of the first predetermined amount to a remaining space of the local index storage is greater than 0 and less than 1.
5. The apparatus of claim 1, wherein the writing, via the second interface, a storage unit index to a first storage area of the storage space in response to a size of remaining space of the local index storage satisfying a second condition comprises:
and when the residual space of the local index memory is smaller than a second threshold value and an index reading request from the space management module is not received, writing a second preset number of storage unit indexes into the first storage area of the storage space through the second interface.
6. The apparatus of claim 5, wherein the writing, via the second interface, a storage unit index to a first storage area of the storage space in response to a size of remaining space of the local index storage satisfying a second condition comprises:
when the remaining space of the local index storage is smaller than a second threshold value, in response to receiving an index read request from the space management module, preferentially reading a storage unit index associated with the index read request.
7. The apparatus of claim 5, wherein a ratio of the second predetermined number to a footprint of the local index storage is greater than 0 and less than 1.
8. The apparatus of claim 1, wherein the local index memory is further configured to maintain a first pointer and a second pointer,
the reading, via the second interface, a storage unit index from a first storage area of the storage space comprises: reading, via the second interface, a storage location index from the first storage area according to a location pointed to by the first pointer,
the writing of the storage unit index to the first storage area of the storage space via the second interface comprises: and writing a storage unit index into the first storage area according to the position pointed by the second pointer through the second interface.
9. The apparatus of claim 1, wherein the space management request comprises a space allocation request, the space management module comprises a space allocation module configured to:
feeding back a completion signal in response to the allocation of the memory location index associated with the space allocation request being completed;
in response to the storage unit index associated with the space allocation request not being allocated and the local index store being non-empty, reading one or more storage unit indices from the local index store;
in response to the storage unit index associated with the space allocation request not being allocated and the local index store being empty, waiting until the local index store is not empty.
10. The apparatus of claim 9, wherein the space allocation module comprises at least two sub-allocation modules, each sub-allocation module corresponding to one of a set of preset sizes and configured to receive sub-allocation requests corresponding to the respective preset sizes.
11. The apparatus of claim 1, wherein the space management request comprises a space reclamation request, the space management module comprising a space reclamation module configured to:
feeding back a completion signal in response to the storage unit index related to the space reclamation request being reclaimed;
writing one or more storage unit indexes into the local index storage in response to the storage unit indexes related to the space reclamation request not being completely reclaimed and the local index storage being not full;
in response to the storage unit index associated with the space reclamation request not being reclaimed and the local index store being full, waiting until the local index store is not full.
12. The apparatus of claim 11, wherein the space reclamation module comprises at least two sub-reclamation modules, each sub-reclamation module corresponding to one of a set of preset sizes and configured to receive sub-reclamation requests corresponding to the respective preset sizes.
13. The apparatus of claim 10 or 12, wherein the local index store comprises at least two sub-index stores, each sub-index store corresponding to one of the set of preset sizes and configured to: reading a memory cell index from a sub-region of the first memory region via the second interface, and writing a memory cell index to the sub-region of the first memory region via the second interface.
14. The apparatus of claim 10 or 12, further comprising a request classification module configured to:
in response to receiving a space allocation request, splitting the space allocation request into one or more sub-allocation requests according to the size of the space requested to be allocated by the space allocation request, wherein each sub-allocation request corresponds to one preset size in the preset size set;
in response to receiving a space recycling request, splitting the space recycling request into one or more sub recycling requests according to a storage unit index corresponding to a space requested to be recycled by the space recycling request, wherein each sub recycling request corresponds to one preset size in the preset size set.
15. The apparatus of claim 1, further comprising:
an initialization module configured to: after the device is powered on, writing a plurality of storage unit indexes in the first storage area of the storage space and/or the local index storage through the second interface.
16. The apparatus of claim 1, wherein the space management module comprises an index generation module configured to generate a storage unit index according to a preset rule, an
Wherein the space management module is configured to: in response to the space management request being a space allocation request and the allocated number of storage unit indexes being lower than a threshold number, causing the index generation module to generate one or more storage unit indexes, where the allocated number of storage unit indexes is a cumulative number of storage unit indexes allocated to the external request source.
17. A computing device comprising the apparatus for managing storage according to any of claims 1-16.
18. A method for managing storage space, comprising:
receiving a space management request from an external request source;
reading storage unit indexes from a first storage area of a local index storage in response to the size of the remaining space of the storage meeting a first condition, wherein each storage unit index is used for representing a storage unit with a preset size in a second storage area of the storage space;
writing a storage unit index into a first storage area of the storage space in response to the size of the remaining space of the local index storage satisfying a second condition;
managing the storage unit index in the local index storage based on the space management request.
19. A chip comprising an apparatus for managing storage space as claimed in any one of claims 1 to 16.
CN202211561700.9A 2022-12-07 2022-12-07 Device and method for managing storage space, computing device and chip Active CN115658328B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211561700.9A CN115658328B (en) 2022-12-07 2022-12-07 Device and method for managing storage space, computing device and chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211561700.9A CN115658328B (en) 2022-12-07 2022-12-07 Device and method for managing storage space, computing device and chip

Publications (2)

Publication Number Publication Date
CN115658328A true CN115658328A (en) 2023-01-31
CN115658328B CN115658328B (en) 2023-10-03

Family

ID=85017438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211561700.9A Active CN115658328B (en) 2022-12-07 2022-12-07 Device and method for managing storage space, computing device and chip

Country Status (1)

Country Link
CN (1) CN115658328B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115934364A (en) * 2023-03-09 2023-04-07 摩尔线程智能科技(北京)有限责任公司 Memory management method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260128A (en) * 2015-09-11 2016-01-20 华为技术有限公司 Method for writing data in storage device and storage device
CN113032293A (en) * 2019-12-24 2021-06-25 北京忆芯科技有限公司 Cache manager and control component
WO2021184996A1 (en) * 2020-03-20 2021-09-23 华为技术有限公司 Data storage method and apparatus for database
CN114741367A (en) * 2022-06-13 2022-07-12 腾讯科技(深圳)有限公司 Data synchronization method, data synchronization device, electronic equipment, storage medium and program product
CN114968102A (en) * 2022-05-27 2022-08-30 广州安凯微电子股份有限公司 Data caching method, device and system, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260128A (en) * 2015-09-11 2016-01-20 华为技术有限公司 Method for writing data in storage device and storage device
CN113032293A (en) * 2019-12-24 2021-06-25 北京忆芯科技有限公司 Cache manager and control component
WO2021184996A1 (en) * 2020-03-20 2021-09-23 华为技术有限公司 Data storage method and apparatus for database
CN114968102A (en) * 2022-05-27 2022-08-30 广州安凯微电子股份有限公司 Data caching method, device and system, computer equipment and storage medium
CN114741367A (en) * 2022-06-13 2022-07-12 腾讯科技(深圳)有限公司 Data synchronization method, data synchronization device, electronic equipment, storage medium and program product

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115934364A (en) * 2023-03-09 2023-04-07 摩尔线程智能科技(北京)有限责任公司 Memory management method and device and electronic equipment
CN115934364B (en) * 2023-03-09 2023-10-31 摩尔线程智能科技(北京)有限责任公司 Memory management method and device and electronic equipment

Also Published As

Publication number Publication date
CN115658328B (en) 2023-10-03

Similar Documents

Publication Publication Date Title
US3647348A (en) Hardware-oriented paging control system
CN110750356B (en) Multi-core interaction method, system and storage medium suitable for nonvolatile memory
KR101835604B1 (en) Scheduler for memory
CN115658328B (en) Device and method for managing storage space, computing device and chip
CN115658326B (en) Device and method for managing storage space, computing device and chip
CN113254222B (en) Task allocation method and system for solid state disk, electronic device and storage medium
CN112748869B (en) Data processing method and device
WO2023124423A1 (en) Storage space allocation method and apparatus, and terminal device and storage medium
US11972110B2 (en) Storage device and storage system
CN115617707B (en) Device and method for managing storage space, computing equipment and chip
CN115599705B (en) Device and method for managing storage space, computing equipment and chip
CN112306927B (en) IO request processing method, device and system
CN115658327B (en) Device and method for managing storage space, computing device and chip
CN115599556B (en) Device and method for managing storage space, computing equipment and chip
CN116048377A (en) Data processing method of solid state disk and related equipment
CN1333346C (en) Method for accessing files
CN107766262B (en) Method and device for adjusting number of concurrent write commands
CN117472792A (en) Apparatus and method for managing storage space, and computing device
US20230266883A1 (en) Memory allocation method and apparatus, electronic device, and storage medium
WO2024113925A1 (en) Storage optimization method and system, device, and readable storage medium
CN116483740B (en) Memory data migration method and device, storage medium and electronic device
CN117472794A (en) Apparatus and method for managing storage space, and computing device
CN117331511B (en) Storage device, data transmission method, device and system thereof and storage medium
CN117472793A (en) Apparatus and method for managing storage space, and computing device
CN115543222B (en) Storage optimization method, system, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant