CN117472794A - Apparatus and method for managing storage space, and computing device - Google Patents

Apparatus and method for managing storage space, and computing device Download PDF

Info

Publication number
CN117472794A
CN117472794A CN202210854148.6A CN202210854148A CN117472794A CN 117472794 A CN117472794 A CN 117472794A CN 202210854148 A CN202210854148 A CN 202210854148A CN 117472794 A CN117472794 A CN 117472794A
Authority
CN
China
Prior art keywords
space
request
storage unit
storage
index
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.)
Pending
Application number
CN202210854148.6A
Other languages
Chinese (zh)
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 CN202210854148.6A priority Critical patent/CN117472794A/en
Publication of CN117472794A publication Critical patent/CN117472794A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory

Abstract

The present disclosure relates to an apparatus, computing device, and method for managing storage space. The device comprises: a first interface connected to the external request source and configured to receive a space management request from the external request source; the second interface is connected with the memory, and the memory comprises a storage space; an initialization module configured to: after the device is powered on, writing a plurality of storage unit indexes into a first storage area of the storage space through a second interface, wherein each storage unit index is used for representing one storage unit with a preset size in a second storage area of the storage space; a space management module configured to: based on the space management request, the storage unit index within the first storage area is managed via the second interface. The device for managing the storage space allows the storage space of the memory to be managed in a hardware mode, and is beneficial to improving management efficiency.

Description

Apparatus and method for managing storage space, and computing device
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to an apparatus for managing storage space, a computing device, and a method for managing storage space.
Background
With the development of computer technology, more and more various computing devices are presented in life, work and study of people. Generally, in these computing devices, there are various forms of processors, controllers, or microcontrollers that, when they run an application to perform a function, need to request a certain amount of space from memory, and when the application is running, the corresponding space can be freed. This involves the management of memory space.
At present, the management of the memory space is generally realized in a software mode, that is, a CPU (central processing unit ) or an MCU (Microcontroller Unit, micro control unit) runs a memory management policy, and issues an instruction, so that a hardware system processes the instruction, and then the read-write operation of the memory is realized through a bus. In the memory management scheme implemented by the 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 storage space, a method for managing storage space, and a computing device, which may alleviate, mitigate, or even eliminate the above-mentioned problems.
According to an aspect of the present disclosure, there is provided an apparatus for managing storage space, including: a first interface connected to the external request source and configured to receive a space management request from the external request source; the second interface is connected with the memory, and the memory comprises a storage space; an initialization module configured to: after the storage space management device is powered on, writing a plurality of storage unit indexes into a first storage area of the storage space through a second interface, wherein each storage unit index is used for representing one storage unit with a preset size in a second storage area of the storage space; a space management module configured to: based on the space management request, the storage unit index within the first storage area is managed via the second interface.
In some embodiments, the space management request includes a space allocation request and a space reclamation request, and wherein the space management module includes: a space allocation module configured to maintain a first pointer and read a storage unit index from a first storage area according to a location pointed to by the first pointer via a second interface based on a space allocation request; and the space recycling module is configured to maintain a second pointer and write a storage unit index to the first storage area according to the position pointed by the second pointer through a second interface based on the space recycling request.
In some embodiments, the first pointer and the second pointer are initialized to point to the same location in the first storage area after the device is powered up.
In some embodiments, the space management request includes a space allocation request and a space reclamation request, and the space management module further includes: the request classification module is configured to store the space allocation request to a first queue and store the space reclamation request to a second queue.
In some embodiments, the request classification module is further configured to pass the space allocation request stored earliest in the first queue to the space allocation module when the space allocation module is in the idle state, and to pass the space reclamation request stored earliest in the second queue to the space allocation module when the space reclamation module is in the idle state.
In some embodiments, the request classification module is further configured to not receive a space allocation request from the external request source when the number of space allocation requests stored in the first queue reaches a first preset threshold, and to not receive a space reclamation request from the external request source when the number of space reclamation requests stored in the second queue reaches a second preset threshold.
In some embodiments, based on the space allocation request, reading, via the second interface, the storage unit index from the first storage area according to the location pointed to by the first pointer comprises: when the space allocation module is in an idle state, determining whether available space in the storage space is greater than or equal to the space requested to be allocated by the space allocation request in response to receiving the space allocation request; in response to the available space in the storage space being greater than or equal to the space requested to be allocated by the space allocation request, sequentially reading one or more storage unit indexes in the first storage area with the position pointed by the first pointer as a starting point based on the size of the space requested to be allocated by the space allocation request, updating the first pointer, feeding back the read one or more storage unit indexes to an external request source, and enabling the space allocation module to restore to an idle state; and in response to the available space in the storage space being smaller than the space requested to be allocated by the space allocation request, feeding back information indicating that the space allocation is failed to an external request source, and enabling the space allocation module to restore to an idle state.
In some embodiments, the space management module further comprises: an index counter configured to change in a first direction based on a number of memory cell indexes read from the first memory area by the space allocation module, and to change in a second direction, opposite to the first direction, based on a number of memory cell indexes written to the first memory area by the space reclamation module; and wherein determining whether remaining available space in the storage space is greater than or equal to the space requested to be allocated by the space allocation request comprises: based at least on the index counter, it is determined whether the storage space corresponding to the available storage unit index is greater than or equal to the space requested to be allocated by the space allocation request.
In some embodiments, sequentially reading one or more memory location indices within the first memory region starting at a location pointed to by the first pointer comprises: sending an index reading request to a memory via a second interface, wherein the index reading request comprises a first pointer and the number of storage unit indexes to be read; the index of the memory location is received from the memory via the second interface and stored to an index queue of the space allocation module.
In some embodiments, feeding back the read one or more storage unit indexes to the external request source and causing the space allocation module to resume the idle state comprises: feeding back the index of the storage units in the index queue to an external request source, and enabling the space allocation module to recover to an idle state after the index feedback of the storage units in the required number is finished.
In some embodiments, based on the space reclamation request, writing the storage unit index to the first storage area via the second interface according to the location pointed to by the second pointer comprises: when the space reclamation module is in an idle state, in response to receiving the space reclamation request, writing one or more storage unit indexes into the first storage area, wherein the written one or more storage unit indexes correspond to the space requested to be reclaimed by the space reclamation request; and responding to the fact that the storage unit indexes corresponding to the space requested to be reclaimed by the space reclamation request are written into the first storage area, feeding back information indicating that the space reclamation is successful to an external request source, and enabling the space reclamation module to restore to an idle state.
In some embodiments, writing one or more storage unit indices to the first storage region includes: writing one or more storage unit indexes into an index queue of the space reclamation module, wherein the written one or more storage unit indexes correspond to spaces requested to be reclaimed by the space reclamation request; an index write request is sent to the memory via the second interface, the index write request including a second pointer and a storage unit index in an index queue.
In some embodiments, the means for managing memory further comprises a bus for connecting the initialization module and the space management module to the second interface.
According to another aspect of the present disclosure, there is provided a computing device comprising an apparatus for managing storage space as described in accordance with embodiments of the foregoing aspects.
According to yet another aspect of the present disclosure, there is provided a method for managing storage space, comprising: after the device is powered on, writing a plurality of storage unit indexes in a first storage area of the storage space, wherein each storage unit index is used for representing one storage unit with a preset size in a second storage area of the storage space; receiving a space management request from an external request source; based on the space management request, the storage unit index within the first storage area is managed.
Through the device for managing the storage space, which is provided by the invention, the memory management is allowed to be realized in a hardware mode, and the problems of long path, high delay and the like caused by a software mode are avoided, 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 means of the independent hardware device for memory management, so that the optimal configuration of the resources is realized, and the overall performance of the computing system is improved. Specifically, the apparatus for managing storage space provided by the present disclosure may receive a space management request from an external request source through a hardware interface, and implement management (e.g., allocation and reclamation) of storage space by managing storage unit indexes within a first storage area. This can enable a quick management of the memory space.
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 present disclosure are disclosed in the following description of exemplary embodiments, with reference to the following drawings, wherein:
FIG. 1 is a schematic diagram illustrating a memory management architecture in the related art;
FIG. 2 schematically illustrates an example block diagram of a storage space management system according to some embodiments of the disclosure;
FIG. 3A schematically illustrates a partitioning scheme of storage space according to some embodiments of the present disclosure;
FIG. 3B schematically illustrates an example flowchart of an initialization module according to some embodiments of the present disclosure;
FIG. 4 schematically illustrates another example block diagram of a storage space management system, according to some embodiments of the disclosure;
5A-5D schematically illustrate an example scheme for managing storage unit indexes with a first pointer and a second pointer;
FIG. 6 schematically illustrates an example block diagram of a request classification module according to some embodiments of the disclosure;
FIG. 7A schematically illustrates an example flow chart of a space allocation process of a space allocation module according to some embodiments of the present disclosure;
FIG. 7B schematically illustrates an example state machine for a space allocation module according to some embodiments of the present disclosure;
FIG. 8 schematically illustrates an example block diagram of a space allocation module according to some embodiments of the disclosure;
FIG. 9A schematically illustrates an example flow diagram of a space reclamation process of a space reclamation module according to some embodiments of the present disclosure;
FIG. 9B schematically illustrates an example state machine for a space reclamation module according to some embodiments of the present disclosure;
FIG. 10 schematically illustrates an example block diagram of a space reclamation module according to some embodiments of the present disclosure;
FIG. 11 schematically illustrates an example block diagram of a computing device according to some embodiments of the disclosure;
fig. 12 schematically illustrates an example flow chart of a space management method according to some embodiments of the 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 should be understood that the described embodiments are merely some, but not all embodiments of the present disclosure. Based on the embodiments in this disclosure, all other embodiments that a person of ordinary skill in the art would obtain without making any inventive effort are within the scope of protection of this disclosure.
Fig. 1 schematically illustrates 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 usable space may be determined according to the internal memory space management policy, and then an instruction for writing data into the corresponding memory space is issued, and the instruction may be processed by hardware and sent to the memory 110 via the bus 130, so as to implement data writing. The process of data reading, deleting, etc. may be similarly implemented. However, the applicant has found that performing memory management in this manner has the following drawbacks: firstly, the resources of a processor (or a controller, a microcontroller and the like) are required to be occupied to execute operations such as space allocation, recovery and the like, which is not beneficial to the efficient utilization of the resources; secondly, the allocation and recovery of the memory space are implemented through software, the instruction is required to be processed through hardware, and then the read-write operation is performed in the memory space through a bus, so that the characteristics of long path, high delay, complex structure and the like are achieved; thirdly, the parallel operation of space recovery and space allocation is difficult to realize by managing the memory in a software mode, so that the improvement of the operation efficiency is limited; etc.
Based on the above considerations, the applicant has proposed a solution for implementing memory management by means of hardware circuits, which helps to solve or alleviate the various problems described above.
FIG. 2 schematically illustrates an example block diagram of a storage space management system 200 according to some embodiments of the disclosure. The storage space management system 200 includes means 210 for managing storage space that can receive a space management request from an external request source 220 and process the received space management request to manage storage space in a memory 230. The memory 230 may be various memories used as a memory, such as a Double Data Rate (DDR) synchronous dynamic random access memory, or other types of memories. By way of example, external request source 220 may be any device that may initiate a space management request, such as a CPU, MCU, etc.
As shown in fig. 2, the apparatus 210 for managing a storage space may include a first interface 211, a second interface 212, an initialization module 213, and a space management module 214. The first interface 211 may be connected to the external request source 220, for example, via a private line or a public line (such as a bus), and is used to enable communication between the external request source 220 and the device 210, for example, to enable 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, which may be, for example, information indicating a storage unit index of the allocated space, a space allocation failure, a space reclamation success, etc., to the external request source 220. The second interface 212 may be configured to connect with the memory 230 and to enable communication between the memory 230 and the device 210, e.g., may send read or write requests from the device 210 to the memory 230, feed back data from the memory 230 to the device 210, etc.
The initialization module 213 may be configured to, after powering up the apparatus 210, write a plurality of storage unit indexes in a first storage area of the storage space of the memory 230 via the second interface 212, wherein each storage unit index is used to characterize one storage unit having a preset size in a second storage area of the storage space. For example, after a power-on reset of the hardware circuit, the initialization module 213 may first write the memory location index into a first memory area of the memory 230, which may be a pre-specified area, and whose size and location may be adjusted as desired. After all the storage unit indexes are written, the device 210 may begin to respond to the space management request from the external request source 220, and thereafter the initialization module 213 may no longer operate until the hardware circuitry is powered down and is again started after the next power-up. Illustratively, when the initialization module 213 completes the index write operation described above, a signal may be sent to a front-end circuit (e.g., a request classification module or other circuit module described below) to inform the front-end circuit that the space management request may begin to be received.
Illustratively, FIG. 3A shows a schematic diagram of a storage space 300. As shown, 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 reserved 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 4 KB, or set to 2 KB, 8 KB, 16 KB, 32 KB, or the like. The first storage area 310 may be written to a plurality of storage unit indexes, each of which may characterize one storage unit in the second storage area 320. For example, when the size of the second storage area is 8Gb, assuming that it is divided into a plurality of storage units at a granularity of 4 KB, the second storage area can be divided into 2097152 storage units in total, thereby requiring 2097152 storage unit indexes in total. Each storage unit index may be stored in the first storage area in 4 bytes (byte), and the size of the first storage area may be 8 MB.
Illustratively, FIG. 3B shows a schematic diagram of an initialization flow 2130 of the initialization module 213. As shown in fig. 3B, at step 2131, the system may wait for power up and complete initialization, or a system reset. Subsequently, in step 2132, the storage unit index may be written to the first storage area of the memory according to pre-stored index data or preset logic. Finally, in step 2133, after all the storage unit indexes have been written, a signal indicating that the storage unit has been written is fed back to the pre-stage circuit module, and then the device 210 may begin receiving and processing space management requests from external request sources.
The space management module 214 may be configured to manage, via the second interface 212, storage unit indexes within the first storage area in the memory 230 based on the space management request. Illustratively, the space management module 214 may read or write the storage unit index from or to the first storage area based on the space management request to complete allocation and reclamation of the corresponding storage unit in the second storage area.
By way of example, the memory space device 210 may be implemented as various types of hardware circuits, such as formed as an integrated circuit, packaged as a chip structure, etc., so as to be used as desired, such as soldered at corresponding pins of a circuit board or plugged into corresponding sockets of a circuit board, etc.
Through the device 210, the storage space of the memory 230 (for example, the internal memory such as DDR) can be managed in a hardware manner, so that the disadvantage of a software management manner can be avoided, a more convenient management manner can be provided, which is beneficial to improving the space management efficiency, saving the processing resources of the main control unit such as CPU or MCU, further improving the operation efficiency of the whole computing system, and optimizing the resource allocation of the whole computing system.
Fig. 4 schematically illustrates another example block diagram of a storage space management system 400 according to some embodiments of this disclosure. Similar to fig. 2, the memory space management system 400 includes a device 410 for managing memory space, an external request source 420, and a memory 430, wherein the external request source 420 and the memory 430 are similar to the external request source 220 and the memory 230 in fig. 2, and are not described again. The apparatus 410 includes an initialization module 412, which is similar to the initialization module 213 in fig. 2 and will not be described again. In addition, in fig. 4, drawing of the first interface and the second interface is omitted for brevity.
As shown in fig. 4, the space management module may include a space allocation module 413 and a space reclamation module 414 for processing the space allocation request and the space reclamation request, respectively, of the space management requests. Space allocation requests may refer to requests for requesting allocation of a size of space in memory 430 for use, and space reclamation requests (or space release requests) may refer to requests for requesting reclamation (or release of) used space in storage area 430. In some embodiments, the space allocation module 413 may be configured to maintain a first pointer and, based on the space allocation request, read the storage unit index from the first storage area according to the location pointed to by the first pointer via the second interface; the space reclamation module 414 may be configured to maintain a second pointer and, based on the space reclamation request, write the storage unit index to the first storage region according to the location pointed to by the second pointer via the second interface. Thus, the space allocation request and the space reclamation request can be managed by the separate space allocation module 413 and the space reclamation module 414, respectively, and the reading and writing of the storage unit index in the first storage area can be managed by the first pointer and the second pointer, respectively, so that the space allocation request and the space reclamation request from the external request source can be simultaneously processed by the parallel processing of the hardware circuit at the same time. Therefore, the storage space management efficiency is further improved.
Fig. 5A-5D schematically show an example scheme of a read and write procedure in a first storage area by means of a first pointer and a second pointer management storage unit index. As shown in the schematic block diagram 500A in fig. 5A, when the device is powered up, the first pointer and the second pointer may be initialized to point to the same location in the first storage area 510, e.g., to both point to the minimum address of the first storage area 510, or to other locations as well. As shown in the schematic block diagram 500B of FIG. 5B, when a space allocation request from an external request source is processed by the space allocation module, a number of storage unit indexes from the first storage area 510 are read, at which point the first pointer will be shifted downward, e.g., to the location of the next readable storage unit index. As shown in the schematic block diagram 500C of FIG. 5C, when a space reclamation request from an external request source is processed by the space reclamation module, the corresponding storage index will be written to the first storage region 510, at which point the second pointer will be shifted downward, e.g., to the location of the next writable storage index. As shown in schematic block diagram 500D in fig. 5D, when the first pointer and/or the second pointer are offset to the maximum address of the first memory region 510, they will wrap around to the starting position. It should be appreciated that fig. 5A-5D are merely illustrative and that the first pointer and the second pointer may also be offset with the reading and writing of the memory cell index in other ways, e.g., may be offset in order from the maximum address to the minimum address of the first memory region, etc.
Returning to FIG. 4, in some embodiments, the space management requests may include space allocation requests and space reclamation requests, and the space management module may further include a request classification module 411. The request classification module 411 may be configured to store space allocation requests to a first queue and space reclamation requests to a second queue. Thus, the space management requests from the external request source can be classified and stored, so that the space allocation requests and the space reclamation requests can be simultaneously transferred to the later modules, namely, the space allocation module and the space reclamation module, thereby further facilitating the parallel processing of the space allocation requests and the space reclamation requests. In addition, the first queue and the second queue can store the received space allocation requests and space reclamation requests, so that when an external request source initiates multiple requests, the back pressure of the external request source can be reduced, and the system efficiency is improved.
Illustratively, fig. 6 schematically illustrates an example block diagram of a request classification module 411 according to some embodiments of the disclosure. As shown in fig. 6, the request classification module 411 may include a first queue 4111 (or referred to as an allocation queue) and a second queue 4112 (or referred to as a reclamation queue). Illustratively, the first queue 4111 and the second queue 4112 may be implemented by one FIFO (First Input First Output, first-in first-out) memory, respectively. Illustratively, the request classification module 411 may receive space management requests from the external request source 420 through a handshake via the first interface, and may then store space allocation requests in the received space management requests to the first queue 4111 and space reclamation requests in the received space management requests to the second queue 4112. Alternatively, the request classification module 411 may be connected to, or may include, a first interface. Subsequently, when the space allocation module of the subsequent stage is in an idle state, the space allocation request with the earliest storage time (i.e., the first write) in the first queue may be transferred to the space allocation module; and when the space reclamation module at the later stage is in an idle state, transferring the space reclamation request with the earliest storage time (namely, the first writing) in the second queue to the space allocation module.
Optionally, due to the limited FIFO memory space, a pre-fill threshold may be set for the first queue 4111 and the second queue 4112. For example, assuming that the first queue 4111 and the second queue 4112 may each receive 10 requests, the pre-full threshold may be set to 9 (or may be set to other values as well). As such, when the number of space allocation requests stored in the first queue 4111 reaches a corresponding pre-full threshold (otherwise referred to as a first threshold), the first queue 4111 may perform a pre-full back pressure and may no longer receive space allocation requests from external request sources; when the number of space reclamation requests stored in the second queue 4112 reaches a corresponding pre-full threshold (or referred to as a second threshold), the second queue 4112 may perform a pre-full back pressure and may no longer receive space reclamation requests from external request sources. Alternatively, the request classification module 411 may back-pressure the front stage when the number of requests stored in either of the first queue 4111 and the second queue 4112 reaches a respective pre-full threshold, i.e., when the number of space allocation requests in the first queue 4111 reaches a first threshold or the number of space reclamation requests in the second queue 4112 reaches a second threshold, no more space management requests from the external request source 420 are received. It should be appreciated that the capacities and pre-fill thresholds of the first and second queues 4111, 4112 described above are merely illustrative, and in practice, the first and second queues 4111, 4112 may have other capacities, and the capacities of the two may be equal or unequal, and may have pre-fill thresholds of other sizes, and the pre-fill thresholds of the two may be equal or unequal. By means of the backpressure mechanism, the request classification module 411 may be prevented from receiving space allocation requests and/or space reclamation requests that exceed its storage capacity, thereby avoiding processing errors.
In some embodiments, the space allocation operations performed by the space allocation module 413 may be implemented by the process 700A shown in FIG. 7A.
First, in step 710, when the space allocation module is in an idle state, in response to receiving the space allocation request, it may be determined whether the available space in the storage space is greater than or equal to the space requested to be allocated by the space allocation request. Illustratively, the idle state may refer to a state in which the space allocation module 413 does not perform a space allocation operation, i.e., there is no space allocation request in the space allocation module 413 that needs to be processed or is being processed. When the space allocation module 413 is in an idle state, it may signal a preceding stage circuit (e.g., a request classification module), for example, by signaling or setting a high correlation signal line, etc., to indicate that it is currently in an idle state, and receive a space allocation request from the preceding stage circuit, for example, from a first queue in the request classification module. By way of example, it may be determined whether there is available space in the storage space and whether the available space is greater than or equal to the space requested to be allocated by the space allocation request by means of the first pointer and the second pointer. For example, when the first pointer and the second pointer do not overlap, it may be determined that there is an assignable storage unit index in the first storage area, that is, it may be determined that there is an assignable available space in the second storage area, further, the number of available storage unit indexes may be determined by a difference between the first pointer and the second pointer, and further, it may be determined whether the number of available storage unit indexes is greater than or equal to the number of storage unit indexes corresponding to the space requested to be allocated by the space allocation request, or it may be determined whether the storage space corresponding to the number of available storage unit indexes is greater than or equal to the space requested to be allocated by the space allocation request; when the first pointer and the second pointer overlap, there may be two cases, i.e. all storage unit indexes have been allocated or all storage unit indexes are available, or no available storage space or all storage space is available, at which time it may be determined which case the current storage space is in by means of the index counter. The index counter may be a structure independent of the space allocation module and the space reclamation module, and may be configured to increase based on the number of storage unit indexes that the space allocation module reads from the first storage area, and to decrease based on the number of storage unit indexes that the space reclamation module writes to the first storage area; or vice versa, i.e. decreasing with a read of the memory cell index and increasing with a write of the memory cell index. Thus, the index counter may indicate the number of storage unit indexes corresponding to the allocated and/or reclaimed storage space. Thus, when the first pointer and the second pointer do not overlap, it may be determined whether there is available space by whether the index counter is zero or maximum. Alternatively, it is also possible to directly determine whether there is an available space and whether the available space is greater than or equal to the space requested to be allocated by the space allocation request by using the index counter without using the first pointer and the second pointer, for example, directly determine whether the storage space corresponding to the available index is greater than or equal to the space requested to be allocated by the space allocation request by using the number of available indexes indicated by the index counter.
Subsequently, in step 720, in response to determining that the available space in the storage space is greater than or equal to the space requested to be allocated by the space allocation request, one or more storage unit indexes may be sequentially read in the first storage area starting from the location pointed to by the first pointer based on the size of the space requested to be allocated by the space allocation request, and the first pointer may be updated. The read index or indices of the memory cells may then be fed back to the external request source and the space allocation module restored to the idle state. For example, a desired number of storage unit indexes may be determined based on the size of the space requested to be allocated by the space allocation request (alternatively, this step may also be accomplished in step 710), and an index read request may be sent to the memory via the second interface, which may include the first pointer and the number of storage unit indexes that need to be read. For example, the required number of storage units, i.e., the required number of storage unit indexes, may be determined based on the size of the space requested to be allocated by the space allocation request and the preset size of the storage units in the second storage area. Alternatively, when the required number of the memory cell indexes is large, the index read requests may be sequentially transmitted to the memory two or more times such that the total number of the memory cell indexes involved in the two or more index read requests is equal to the determined required number of the memory cell indexes. The index of the memory location fed back by the memory may then be received via the second interface and stored into an index queue of the space allocation module. For example, when an index read request is sent to the memory, the memory may feed back corresponding memory location index data in response to the index read request, and the space allocation module 413 may receive and temporarily store the data in a local index queue for transmission to the external request source 420. For example, when the remaining space of the local index queue is greater than or equal to the storage space required for the storage unit indexes from the memory, these storage unit indexes from the memory may be normally received and stored; otherwise, when the space is insufficient, the receiving can be stopped temporarily, and the space meeting the requirement can be waited until the local index queue exists. And then, feeding back the index of the storage units in the index queue to an external request source, and enabling the space allocation module to recover to an idle state after the required number of index feedback of the storage units is finished. For example, when the number of storage unit indexes is large, feedback may be performed to the external request source in batches. In other words, as the storage unit index is read from memory 430 to the local index queue, the storage unit index in the local index queue may be fed back to external request source 420 in batches. Through the cache mechanism of the local index queue, the problems that the data interaction speed between the memory and the memory space management device is not matched with the data interaction speed of an external request source between the memory space management device or the idle time of the memory space management device and the external request source are not completely consistent with each other can be relieved, and therefore the space management efficiency is further improved. The use and updating of the first pointer is shown in fig. 5A-5D and described in the relevant paragraphs, and will not be repeated here.
Alternatively, in step 730, in response to the available space in the storage space being less than the space requested to be allocated by the space allocation request, information indicating that the space allocation has failed may be fed back to the external request source and the space allocation module may be restored to the idle state. Illustratively, the information indicating the failure of space allocation may be fed back to the external request source through a preset string or other means, and the external request source may choose whether to retransmit the space allocation request according to circumstances after receiving the information.
Illustratively, the space allocation module 413 may be controlled by the state machine 700B shown in fig. 7B.
As shown in fig. 7B, when no space allocation request is received, the state machine 700B may be in the IDLE state, i.e., the above-described IDLE state. When the space allocation request is received, whether the current available space meets the requirement of the space allocation request or not can be judged, namely, whether the current available space is larger than or equal to the space requested to be allocated by the space allocation request or not. If not, the information indicating the space allocation failure can be fed back to an external request source, and the IDLE state is skipped; if so, the storage unit index can be read from the memory, and the read storage unit index is stored in the local index queue. Then, in the case that the local index queue is not empty, the storage unit index may be allocated, that is, the storage unit index in the local index queue is fed back to the external request source until all the storage unit indexes are fed back, and the state is restored to the IDLE state again. Various operations involved in state machine 700B have been described in various embodiments with reference to fig. 7A and are not described in detail herein.
In some embodiments, the space allocation module may be implemented by the circuit structure shown in fig. 8 or other similar structures.
As shown in fig. 8, the space allocation module 800 may include a read address maintenance circuit 810, a bus data sort circuit 820, a response processing circuit 830, and a FIFO 840. The read address maintenance circuit 810 may manage the first pointer in accordance with the manner described previously with reference to fig. 5A-5D. Bus data sort circuit 820 may process the received space allocation requests to generate control signals conforming to the respective bus protocol, which may include, for example, the index read requests for memory space indexes mentioned previously, and which may be sent to memory (e.g., DDR memory, etc.) via the respective bus structures. FIFO 840 may act as a local index queue for the aforementioned space allocation module and serve to buffer the storage unit index from memory. For example, the memory may transmit a corresponding data signal, which may include one or more memory cell indexes corresponding to the index read request, to the space allocation module 800 in response to the control signal. And, illustratively, when all the unit indexes have been sent, the memory may send a response signal to the space allocation module 800 indicating that the index read request is processed (or, alternatively, that the unit indexes have been sent). The response processing module 830 may receive the response signal and feedback a completion signal to the external request source based on the response signal, for example, via the upper circuit module, the completion signal may include at least one of the following information: information indicating that the current space allocation request has been processed, a storage unit index read from the memory, and the like. Alternatively or additionally, the space allocation module 800 may also include other circuitry as long as the functions of the space allocation module described in the various embodiments above may be implemented.
In some embodiments, the space reclamation operations performed by the space reclamation module 414 may be implemented by the process 900A shown in FIG. 9A.
In step 910, when the space reclamation module is in an idle state, in response to receiving the space reclamation request, one or more storage unit indexes are written to the first storage region, the written one or more storage unit indexes corresponding to the space that is requested to be reclaimed by the space reclamation request. For example, the space reclamation request may include a storage unit index to be written, or may include other information that may be converted to a storage unit index to be written. Illustratively, the storage unit index that needs to be written to the first storage area may be first cached in the local index queue of the space reclamation module 414. For example, upon receiving a space reclamation request, one or more storage unit indexes may be written to an index queue of the space reclamation module, the written one or more storage unit indexes corresponding to spaces requested to be reclaimed by the space reclamation request; an index write request may then be sent to the memory via the second interface, the index write request including the second pointer and the storage unit index in the index queue. Alternatively, when the number of indexes to be written is large, the plurality of storage unit indexes may be written to the first storage area in batches, that is, the index write request may be sent to the memory a plurality of times. Alternatively, the process of caching the storage unit index into the local index queue and writing the storage unit index in the local index queue to the first storage area may be performed in parallel until all the storage unit indexes to be written are written to the first storage area.
In step 920, in response to the storage unit index corresponding to the space requested to be reclaimed by the space reclamation request having been written to the first storage area, information indicating that the space reclamation is successful is fed back to the external request source, and the space reclamation module is caused to resume the idle state. Illustratively, the space reclamation module 414 may, after feeding back information indicating that space reclamation was successful to the external request source, revert to the idle state after receiving a confirmation message from the external request source to ensure that the external request source is aware of the information.
Illustratively, the space reclamation module 414 may be controlled by a state machine 900B shown in fig. 9B.
As shown in fig. 9B, state machine 900B may be in an IDLE state when no space reclamation request is received. When a space reclamation request is received, a write operation to the storage unit index may be initiated. For example, as previously described, the storage unit index to which the space reclamation request relates may be written to the local index queue, and then the index write request may be generated based on the storage unit index in the local index queue. A write operation to the memory may then be initiated, i.e., the memory cell index in the local index queue is written to the first memory region in the memory by sending an index write operation until all the memory cell indices are written, and restored to the IDLE state again. Various operations involved in state machine 900B have been described in various embodiments with reference to fig. 9A and are not described in detail herein.
In some embodiments, the space reclamation module may be implemented by the circuit structure shown in fig. 10 or other similar structures.
As shown in fig. 10, space reclamation module 1000 may include a write address maintenance circuit 1010, a bus data sort circuit 1020, a response processing circuit 1030, and a FIFO 1040. The write address maintenance circuit 1010 may manage the second pointer in accordance with the manner described previously with reference to fig. 5A-5D. The bus data grooming circuit 1020 may process the received space reclamation requests to generate control signals and data signals that conform to the respective bus protocol, which may include, for example, the index write requests for the memory space index mentioned previously, which may include a memory cell index to be written to a first memory region of the memory, and which may be sent to the memory (e.g., DDR memory, etc.) via the respective bus structure. FIFO 1040 may serve as the aforementioned local index queue for the space reclamation module and is used to buffer the storage unit index associated with the space reclamation request from the external request source, i.e., the storage unit index requested to be reclaimed by the space reclamation request. For example, the memory may perform an index write operation in response to the control signal and the data signal, and transmit a corresponding response signal to the space allocation module 800 after the write is completed. The response processing module 1030 may receive the response signal, and feedback a completion signal to the external request source based on the response signal, for example, via the upper circuit module, where the completion signal may include information indicating that the current space recovery request is processed. Alternatively or additionally, the space allocation module 1000 may also include other circuitry as long as the functions of the space allocation module described in the various embodiments above may be implemented.
In some embodiments, the means for managing storage space may further comprise a bus that may connect the initialization module and the space management module to the second interface. Illustratively, as shown in FIG. 4, a bus 415 may be coupled to the initialization module 412, the space allocation module 413, and the space reclamation module 414 so that these modules may interact with the memory 430 via a second interface (not shown) of the apparatus 410. The bus 415 may be, for example, a standard NOC (Network on Chip) bus, or may be implemented using other types of buses. Further, bus 415 may optionally also connect other modules that are related or unrelated to the various modules described in the present disclosure.
In some embodiments of the present disclosure, a computing device is also provided that may include the apparatus for managing storage space described previously, such as apparatus 210, 410. Schematically, fig. 11 illustrates an example block diagram of a computing device 1100. As shown, computing device 1100 may include means 1110 for managing storage space, which may perform storage space management functions as described in the various embodiments above. Computing device 1100 may also include a processor or controller 1120, which may be implemented as a CPU, MCU or similar structure, and may be used to perform various processing or control operations. Computing device 1100 can also include memory 1130 that can be used to store data such as various program data required by processor or controller 1120 when executing applications or data used or generated during execution of applications, and the like. The memory 1130 is implemented as a single memory, for example, or as a combination of two or more memories. For example, the memory 1130 may include one or more internal memories, such as DDR memory or SDRAM memory or the like, used as memory. The means for managing storage 1110, the processor/controller 1120, and the memory 1130 may be coupled together by communication lines 1140 and enable data transfer between each other. The communication lines 1140 may be, for example, a bus (such as an AXI bus, etc.) or other type of communication lines, or may be a combination thereof.
In some embodiments of the present disclosure, a method for managing storage space is also provided. Illustratively, FIG. 12 shows an example flowchart of a method 1200 for managing storage space.
As shown in fig. 12, in step 1210, after the device is powered on, a plurality of storage unit indexes may be written into a first storage area of the storage space, where each storage unit index is used to characterize a storage unit having a preset size in a second storage area of the storage space; at step 1220, a space management request from an external request source may be received; at step 1230, the storage unit index within the first storage area may be managed based on the space management request.
The method 1200 may have the same or similar embodiments as the previously described means for managing storage space and may have the same or similar technical effects. For brevity, the description is omitted here.
In the description of the present disclosure, the azimuth or positional relationship indicated by the terms "upper", "lower", "left", "right", etc., are based on the azimuth or positional relationship shown in the drawings, and are merely for convenience of describing the present disclosure, not to require that the present disclosure must be constructed and operated in a specific azimuth, and thus should not be construed as limiting the present disclosure.
In the description of the present specification, reference to the term "one embodiment," "another embodiment," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment is included in at least one embodiment of the present disclosure. In this specification, schematic representations of the above terms are not necessarily directed 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, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction. In addition, it should be noted that, in this specification, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present disclosure, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the present disclosure, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally formed; the device can be mechanically connected, electrically connected and communicated; can be directly connected or indirectly connected through an intermediate medium, and can be communicated with the inside of two elements or the interaction relationship of the two elements. The specific meaning of the terms in this disclosure will be understood by those of ordinary skill in the art as the case may be.
The foregoing is merely a specific embodiment of the disclosure, but the scope of the disclosure is not limited thereto. Any changes or substitutions that would be readily apparent to one of ordinary skill in the art within the scope of the present disclosure are intended to be encompassed 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 (15)

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;
an initialization module configured to: after the device is powered on, writing a plurality of storage unit indexes into a first storage area of the storage space through the second interface, wherein each storage unit index is used for representing one storage unit with a preset size in a second storage area of the storage space;
a space management module configured to: based on the space management request, a storage unit index within the first storage area is managed via the second interface.
2. The apparatus of claim 1, wherein the space management request comprises a space allocation request and a space reclamation request, and wherein the space management module comprises:
a space allocation module configured to maintain a first pointer and to read a storage unit index from the first storage area according to a location pointed to by the first pointer via the second interface based on a space allocation request;
and the space recycling module is configured to maintain a second pointer and write a storage unit index into the first storage area according to the pointed position of the second pointer through the second interface based on the space recycling request.
3. The apparatus of claim 2, wherein the first pointer and the second pointer are initialized to point to a same location in the first storage area upon power-up of the apparatus.
4. The apparatus of claim 2, wherein the space management request comprises a space allocation request and a space reclamation request, and wherein the space management module further comprises:
a request classification module configured to store the space allocation request to a first queue and store the space reclamation request to a second queue.
5. The apparatus of claim 4, wherein the request classification module is further configured to pass a space allocation request stored earliest in the first queue to the space allocation module when the space allocation module is in an idle state, and to pass a space reclamation request stored earliest in the second queue to the space allocation module when the space reclamation module is in an idle state.
6. The apparatus of claim 5, wherein the request classification module is further configured to not receive a space allocation request from the external request source when the number of space allocation requests stored in the first queue reaches a first preset threshold, and to not receive a space reclamation request from the external request source when the number of space reclamation requests stored in the second queue reaches a second preset threshold.
7. The apparatus of claim 2, wherein the reading, via the second interface, a storage unit index from the first storage area according to a location pointed to by the first pointer based on the space allocation request comprises:
when the space allocation module is in an idle state, determining whether available space in the storage space is greater than or equal to the space requested to be allocated by the space allocation request in response to receiving the space allocation request;
in response to the available space in the storage space being greater than or equal to the space requested to be allocated by the space allocation request, sequentially reading one or more storage unit indexes in the first storage area with the position pointed by the first pointer as a starting point based on the size of the space requested to be allocated by the space allocation request, updating the first pointer, feeding back the read one or more storage unit indexes to the external request source, and enabling the space allocation module to restore to the idle state;
and in response to the available space in the storage space being smaller than the space requested to be allocated by the space allocation request, feeding back information indicating that the space allocation is failed to the external request source, and enabling the space allocation module to restore to the idle state.
8. The apparatus of claim 7, wherein the spatial management module further comprises:
an index counter configured to vary in a first direction based on a number of memory cell indexes read by the space allocation module from the first memory region, and in a second direction, opposite to the first direction, based on a number of memory cell indexes written by the space reclamation module to the first memory region;
and wherein said determining whether remaining available space in said storage space is greater than or equal to space requested to be allocated by said space allocation request comprises:
based at least on the index counter, it is determined whether a storage space corresponding to an available storage unit index is greater than or equal to a space requested to be allocated by the space allocation request.
9. The apparatus of claim 7, wherein the sequentially reading one or more storage unit indexes within the first storage area starting from a location pointed to by the first pointer comprises:
sending an index read request to the memory via the second interface, the index read request including the first pointer and a number of storage unit indexes to be read;
And receiving a storage unit index from the memory through the second interface and storing the index to an index queue of the space allocation module.
10. The apparatus of claim 9, wherein the feeding back the read one or more storage unit indexes to the external request source and causing the space allocation module to revert to the idle state comprises:
and feeding back the index of the storage units in the index queue to the external request source, and enabling the space allocation module to recover to the idle state after the required number of index of the storage units are fed back.
11. The apparatus of claim 2, wherein the writing, via the second interface, a storage unit index to the first storage area according to a location pointed to by the second pointer based on the space reclamation request comprises:
when the space reclamation module is in an idle state, in response to receiving a space reclamation request, writing one or more storage unit indexes into the first storage area, wherein the written one or more storage unit indexes correspond to the space requested to be reclaimed by the space reclamation request;
and responding to that the storage unit index corresponding to the space requested to be reclaimed by the space reclamation request is completely written into the first storage area, feeding back information indicating that the space reclamation is successful to the external request source, and enabling the space reclamation module to restore to the idle state.
12. The apparatus of claim 9, wherein the writing one or more storage unit indices to the first storage area comprises:
writing one or more storage unit indexes into an index queue of the space reclamation module, wherein the written one or more storage unit indexes correspond to spaces requested to be reclaimed by the space reclamation request;
an index write request is sent to the memory via the second interface, the index write request including the second pointer and a storage unit index in the index queue.
13. The apparatus of claim 1, further comprising a bus for connecting the initialization module and the space management module to the second interface.
14. A computing device comprising the apparatus for managing storage space of any of claims 1-13.
15. A method for managing storage space, comprising:
after the device is powered on, writing a plurality of storage unit indexes in a first storage area of the storage space, wherein each storage unit index is used for representing one storage unit with a preset size in a second storage area of the storage space;
Receiving a space management request from an external request source;
and managing the storage unit index in the first storage area based on the space management request.
CN202210854148.6A 2022-07-20 2022-07-20 Apparatus and method for managing storage space, and computing device Pending CN117472794A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210854148.6A CN117472794A (en) 2022-07-20 2022-07-20 Apparatus and method for managing storage space, and computing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210854148.6A CN117472794A (en) 2022-07-20 2022-07-20 Apparatus and method for managing storage space, and computing device

Publications (1)

Publication Number Publication Date
CN117472794A true CN117472794A (en) 2024-01-30

Family

ID=89626103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210854148.6A Pending CN117472794A (en) 2022-07-20 2022-07-20 Apparatus and method for managing storage space, and computing device

Country Status (1)

Country Link
CN (1) CN117472794A (en)

Similar Documents

Publication Publication Date Title
US11929927B2 (en) Network interface for data transport in heterogeneous computing environments
US10951741B2 (en) Computer device and method for reading or writing data by computer device
US11775454B2 (en) Mechanism to autonomously manage SSDs in an array
CN109314103B (en) Method and apparatus for remote field programmable gate array processing
CN113760185A (en) Memory block recovery method and device
CN111176584A (en) Data processing method and device based on hybrid memory
EP4002139A2 (en) Memory expander, host device using memory expander, and operation method of server system including memory expander
CN113468083B (en) Dual-port NVMe controller and control method
CN115658328B (en) Device and method for managing storage space, computing device and chip
EP3398067A1 (en) Method and system for shared direct access storage
CN115658326B (en) Device and method for managing storage space, computing device and chip
CN117472794A (en) Apparatus and method for managing storage space, and computing device
EP4105771A1 (en) Storage controller, computational storage device, and operational method of computational storage device
CN115617707B (en) Device and method for managing storage space, computing equipment and chip
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
CN117472792A (en) Apparatus and method for managing storage space, and computing device
CN115599705B (en) Device and method for managing storage space, computing equipment and chip
CN117472793A (en) Apparatus and method for managing storage space, and computing device
WO2023169142A1 (en) Storage apparatus and related data partition management method
WO2024051292A1 (en) Data processing system, memory mirroring method and apparatus, and computing device
US20230359389A1 (en) Operation method of host configured to communicate with storage devices and memory devices, and system including storage devices and memory devices
EP4273708A1 (en) Operation method of host configured to communicate with storage devices and memory devices, and system including storage devices and memory devices
US20190303316A1 (en) Hardware based virtual memory management
CN117009278A (en) Computing system and method of operating the same

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