Resource allocation method and device, electronic equipment and medium
By acquiring word line resource bitmaps and preset resource pools, the load between multiple cores is dynamically adjusted, solving the problem of extreme load imbalance in multi-core collaborative synchronous write tasks, achieving load balancing and efficient resource allocation, and improving the write performance of flash hard drives.
Patent Information
- Application Number
- CN202410546409.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-10-31
AI Technical Summary
In existing technologies, multi-core collaborative synchronization for SWL write tasks suffers from extreme load imbalance, causing one core to be busy with other I/O tasks while other cores wait for resources for a long time, and may even lead to deadlock and timeout.
By obtaining the available status bitmap of word line resources, the load among multiple cores is dynamically adjusted, resources are allocated to the kernels as needed, a preset resource pool is established, dynamic resource allocation and load balancing are achieved, and an access locking mechanism is used to ensure the atomicity of resource allocation.
It achieves load balancing between cores, avoids extreme load imbalance, improves write performance, and reduces the possibility of write latency service quality degradation and IO request blocking.
Smart Images

Figure CN120872231A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and mainly to a resource allocation method, apparatus, electronic device and medium. Background Technology
[0002] To address the current high-concurrency write requirements of flash drives, multi-core load balancing is needed to ensure that multiple cores collaboratively and synchronously process SWL (Super Word-Line) write tasks. Related technologies employ methods such as evenly distributing tasks among cores using statically fixed resource sets, or dynamically allocating tasks based on historical inter-core load statistics. However, due to the uncertainty of task distribution, these methods still struggle to guarantee load balancing among cores and are prone to extreme load imbalances. An extreme load imbalance occurs when a core (denoted as the i-core) is continuously busy with I / O tasks other than host writes, eventually leading to all other cores completing their allocated SWL write tasks and reaching the maximum number of SWL write tasks, while the i-core remains stuck at the beginning of the SWL write task. This will lead to the following: the initial SWL write task cannot complete programming; subsequent SWL write tasks, due to the inability of the initial SWL to complete programming and the limitations of NAND characteristics, cannot send programming requests; the SWL write task limit is reached, preventing the initiation of new SWL write tasks and the allocation of WL (Word-Line) resources to other cores. Therefore, under extreme load imbalance, other cores may experience a near-deadlock situation, waiting for a long time to acquire resources, and may even time out.
[0003] Therefore, how to allocate resources to avoid extreme load imbalance is an urgent problem to be solved. Summary of the Invention
[0004] One objective of this application is to provide a resource allocation method to solve, or at least partially solve, problems in the related art. A second objective is to provide a resource allocation apparatus; a third objective is to provide an electronic device; and a fourth objective is to provide a medium.
[0005] To achieve the above objectives, the technical solution of this application is as follows:
[0006] A resource allocation method, comprising:
[0007] Obtain the first image; the first image is used to represent the availability status of word line resources;
[0008] Receive resource requests; the resource requests include the identifier of the requesting kernel;
[0009] In response to the resource request, word line resources are allocated to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel.
[0010] Optionally, the resource request further includes the requested resource quantity; the step of allocating word line resources to the request kernel in response to the resource request, based on the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel, includes:
[0011] Obtain the first mapping relationship, which is used to represent the correspondence between each kernel and the preset resource pool;
[0012] Based on the first mapping relationship, determine the target preset resource pool corresponding to the identifier of the request kernel;
[0013] Based on the first bitmap, determine the currently available word line resources in the target preset resource pool;
[0014] If the number of currently available word lines in the target preset resource pool is greater than or equal to the number of requested resources, the number of currently available word lines in the target preset resource pool that are the number of requested resources will be allocated to the request kernel.
[0015] If the number of currently available word line resources in the target preset resource pool is less than the number of requested resources, the currently available word line resources in another preset resource pool corresponding to other request kernels will be allocated to the request kernel.
[0016] Optionally, the method further includes:
[0017] Record the identifier of the other preset resource pool;
[0018] If the number of available wordline resources in the target preset resource pool corresponding to the next request kernel is less than the number of requested resources, available wordline resources are searched and allocated according to the identifier of the other preset resource pool.
[0019] Optionally, after allocating word line resources to the request kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel, the method further includes:
[0020] Update the second bitmap, which is used to represent the data write status of the currently allocated word line resources;
[0021] If the difference between the number of tasks currently in execution and the total number of tasks is less than the task threshold, determine the first task to be executed among the tasks currently in execution.
[0022] Based on the second bitmap, obtain the data write status of the word line resource corresponding to the first task;
[0023] If there is a first word line resource in the word line resource corresponding to the first task that is not full of data, fill data is written into the first word line resource.
[0024] Optionally, the method further includes:
[0025] Establish a second mapping relationship, which is used to represent the correspondence between each requesting kernel and the currently allocated word line resources;
[0026] The step of writing padding data into the first word line resource includes:
[0027] Based on the second mapping relationship, determine the target request kernel to which the first word line resource belongs;
[0028] The target request kernel writes the padding data into the first word line resource.
[0029] Optionally, updating the second bitmap includes:
[0030] Check the data write status of currently allocated word line resources;
[0031] Based on the data writing status of the currently allocated word line resources, the bit parameters of the currently allocated word line resources that are in the data full state are set to 1 in the second bitmap, and the bit parameters of the currently allocated word line resources that are in the data incomplete state are set to 0 in the second bitmap.
[0032] Optionally, the resource request further includes a request time; after receiving the resource request, the method further includes:
[0033] The resource requests are arranged in the request queue according to the order of their request times.
[0034] Retrieve the resource request with the earliest request time from the current request queue and respond to the resource request using an access locking mechanism.
[0035] A resource allocation device, comprising:
[0036] The acquisition module is used to acquire the first bit image; the first bit image is used to represent the availability status of word line resources.
[0037] A receiving module is used to receive resource requests; the resource request includes the identifier of the requesting kernel;
[0038] The allocation module is used to respond to the resource request by allocating word line resources to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel.
[0039] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the resource allocation method described above.
[0040] A non-volatile storage medium storing a computer program that, when executed by a processor, implements the resource allocation method described above.
[0041] The beneficial effects of this application are:
[0042] In this application, a first bitmap is obtained; the first bitmap is used to characterize the availability status of word line resources; a resource request is received; the resource request includes the identifier of the requesting kernel; in response to the resource request, word line resources are allocated to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel; the preset resource pool corresponding to the identifier of the requesting kernel is used to pre-record the resources to be allocated to the requesting kernel, that is, preset resource pools corresponding to each kernel are set up in advance for a SWL, and the word line resources to be allocated to each kernel are recorded. When allocating resources, available word line resources are dynamically allocated to the requesting kernel based on the first bitmap and the preset resource pool corresponding to the requesting kernel, so that each kernel participates in a SWL write task and contributes equally. In this way, load balancing between cores can be achieved, avoiding the problem of extreme load imbalance. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a flowchart of a resource allocation method described in one embodiment of this application;
[0045] Figure 2 This is a partial logic diagram of the resource allocation method described in one embodiment of this application;
[0046] Figure 3 This is a partial data link diagram of the resource allocation method described in one embodiment of this application;
[0047] Figure 4 This is a schematic diagram of the framework of the resource allocation device described in one embodiment of this application.
[0048] Among them, 400 is the resource allocation device, 401 is the acquisition module, 402 is the receiving module, and 403 is the allocation module. Detailed Implementation
[0049] The embodiments of this application will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for illustrating this application and are not intended to limit the scope of protection of this application.
[0050] The development of the information age has placed increasingly higher demands on the performance and reliability of storage devices to meet the ever-growing demand for data storage. Since the beginning of the 21st century, solid-state drive (SSD) technology based on NAND flash memory has developed rapidly and gained widespread application. NAND flash memory-based SSD technology offers advantages such as high reliability, high performance, lightweight design, and low power consumption.
[0051] NAND flash-based solid-state drives (SSDs) require an MCU (microprocessor) to run firmware to manage basic operations such as reading, writing, erasing, and table updates. The FTL (Flash Translation Layer) in the firmware is responsible for translating front-end I / O requests into corresponding back-end I / O operation commands and maintaining the L2P table (a mapping table between logical and physical addresses). As flash memory speeds increase and the PCIe (Peripheral Component Interconnect Express) standard is updated, SSD performance is being improved by increasing parallelism. This involves using more MCU cores and multi-core parallel algorithms to improve firmware processing efficiency and front-end / back-end I / O command processing efficiency, thereby enhancing performance.
[0052] The basic storage unit of NAND flash memory is a floating-gate transistor. After a write operation, the floating gate layer of the floating-gate transistor traps electrons; the number of electrons affects the threshold voltage of the floating-gate transistor to varying degrees. By applying a suitable voltage and determining whether the floating-gate transistor is conducting, the amount of data stored in a particular floating-gate transistor can be determined. Thousands of floating-gate transistors connected in series at their source and drain terminals form a WL (Word-Line). Generally, the smallest unit for NAND flash memory to perform Program (writing) and read operations is a WL. Word-Lines at the same location on multiple Planes (a separate storage array within a NAND flash chip) can be combined into a SWL (Super Word-Line). This allows multiple WLs on a single SWL to be operated simultaneously in a multi-core, multi-channel manner during read / write operations, thereby increasing concurrency and improving performance. Due to the limitations of NAND flash memory, write operations must be programmed sequentially. This means that writes to the same location on all planes can be written simultaneously, but the next location's writes cannot begin until the current location's writes are programmed. This implies that the FTL (Flash Threading Layer) must ensure that multiple cores complete a single write task to a single write line when processing host write commands.
[0053] The core technical concept of this application is to record the availability status of word line resources through word line bitmap, dynamically adjust the load between multiple cores based on word line bitmap, allocate resources to the cores as needed, and ensure that the load pressure of each SWL write task (one SWL write task means multiple cores writing to one SWL at the same time) is balanced for each core, and resources can be released in time, thus avoiding the problem of extreme load imbalance.
[0054] Reference Figure 1 , Figure 1 This is a flowchart of a resource allocation method according to an embodiment of this application. In this application, a resource allocation method is applied to a resource allocation device. When the resource allocation device allocates resources corresponding to a SWL write task, it specifically performs the following steps:
[0055] Step S101: Obtain the first image; the first image is used to determine the currently available word line resources;
[0056] Specifically, the first diagram is used to represent the availability status of word line resources. That is, the first diagram shows which word lines (WLs) in the SWL are available and which WLs are occupied and cannot be allocated.
[0057] In parallel-write NAND SSDs (NAND Solid State Disks), multiple cores simultaneously write to a single Write Level (SWL), forming a single SWL write task. The Write Level (WL) carries PBA (Physical Block Address) resources. Therefore, the WL obtained by each core naturally determines which PBAs it receives. Before allocating resources to the core for an SWL write task, the resource allocation device initializes the first bitmap (available WL bitmap) of that SWL write task. At this time, all word line resources have not yet been allocated; therefore, during initialization, all bit parameters in the first bitmap are set to 0, meaning all word line resources are in a free and available state (0 indicates the corresponding WL is free and available; 1 indicates the corresponding WL is busy and has been allocated, and is unavailable). In practical applications, the structure of the WL bitmap is determined by the physical structure of the NAND flash memory and the firmware management method.
[0058] When the resource allocation device allocates resources for a SWL write task, it first obtains the first bit map of the task to determine the currently available WL resources.
[0059] Step S102: Receive a resource request; the resource request includes the identifier of the requesting kernel;
[0060] Specifically, before the resource allocation device starts and executes the resource allocation task, the first bit diagram is initialized. After determining the currently available word line resources based on the first bit diagram, the resource allocation task can be executed: receiving resource requests sent by each kernel, which includes at least the identifier of the requesting kernel (such as name, number, etc.), so as to allocate the word line resources required by the kernel for the write task received by the kernel according to the identifier of the requesting kernel.
[0061] Step S103: In response to the resource request, allocate word line resources to the request kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel.
[0062] Specifically, the preset resource pool corresponding to the identifier of the requesting kernel is used to pre-plan the resources to be allocated to the requesting kernel. When no extreme load imbalance occurs, the number of word line resources written per unit time by each kernel is basically the same. Therefore, according to the structure of NAND flash memory, the word line resources on a superword line are first evenly divided as the preset resource pool for each core.
[0063] After receiving a resource request from the kernel, the resource allocation device determines the allocatable word line resources based on the first bit map of the current SWL write task. Then, according to the target preset resource pool corresponding to the requesting kernel, it allocates the currently available word line resources from the pre-set word line resources to be allocated to the requesting kernel. This application performs dynamic resource allocation for each kernel in real time based on the first bit map (available word line bit map) and the preset resource pool corresponding to each core.
[0064] In this embodiment, a first bitmap is obtained; the first bitmap is used to characterize the availability status of word line resources; a resource request is received; the resource request includes the identifier of the requesting kernel; in response to the resource request, word line resources are allocated to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel; the preset resource pool corresponding to the identifier of the requesting kernel is used to pre-record the resources to be allocated to the requesting kernel, that is, preset resource pools for each kernel are set up in advance for a SWL, and the word line resources to be allocated to each kernel are recorded. When allocating resources, available word line resources are allocated to the requesting kernel based on the first bitmap and the preset resource pool corresponding to the requesting kernel, so that each core participates in a SWL write task and contributes equally. In this way, load balancing between cores can be achieved, avoiding the problem of extreme load imbalance.
[0065] In one embodiment of this application, after allocating word line resources to the requesting kernel, the resource allocation method further includes updating the bitmap. Specifically, the current word line resource allocation status is first detected; based on the current word line resource allocation status, the bit parameters corresponding to the allocated word line resources in the bitmap are set to 1, and the bit parameters corresponding to the unallocated word line resources in the bitmap are set to 0. Therefore, based on the bit parameters (0 / 1) corresponding to each word line in the bitmap, it is possible to quickly determine whether the current word line resource is available for allocation and to statistically analyze the resource availability. Based on the bitmap, resource requests can be responded to quickly, and the word line resources allocated to each kernel can be determined.
[0066] In this embodiment, after allocating word line resources to the requesting kernel in response to a resource request, the first bit map is immediately updated to promptly determine the allocable word lines based on the current word line resource availability. This achieves statistical management of shared resources across multiple cores, avoids resource conflicts between kernels, and ensures the normal execution of I / O requests.
[0067] In one embodiment of this application, the resource request further includes a request time, and after receiving the resource request, the resource allocation method further includes:
[0068] The resource requests are arranged in the request queue in chronological order of their request times.
[0069] Retrieve the resource request with the earliest request time from the current request queue and respond to the resource request using an access locking mechanism.
[0070] Specifically, the access locking mechanism is a software mechanism used to ensure exclusive access to shared resources. It prevents multiple threads or processes from modifying shared data simultaneously, thus avoiding data corruption and inconsistency. After the resource allocation device receives a resource request, it can respond directly if the request queue is empty, entering an access locking state while responding to the resource request. If other cores access the resource allocation device, their access requests (resource requests) are added to the queue in sequence. Before the currently requesting kernel returns an output value (such as the allocated word resource identifier), other cores' access requests will not be processed simultaneously, ensuring the atomicity of a complete access operation (resource allocation operation). If there are other unresponded resource requests in the request queue, they are arranged in order of request time and then responded to sequentially according to the First In, First Out (FIFO) principle.
[0071] In this embodiment, when responding to a resource request, the requesting kernel accesses the resource allocation device. The resource allocation device employs an access locking mechanism to allocate resources to the requesting kernel. This prevents resource contention and ensures the atomicity of the resource allocation operation. Consequently, each requesting kernel acquires word line resources sequentially, and the time for each requesting kernel to access the resource allocation device is consistent, avoiding write latency-induced degradation of Quality of Service (QoS).
[0072] In one embodiment of this application, the resource request further includes a requested resource quantity; the step of allocating word line resources to the request kernel in response to the resource request, based on the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel, includes:
[0073] Obtain the first mapping relationship, which is used to represent the correspondence between each kernel and the preset resource pool;
[0074] Based on the first mapping relationship, determine the target preset resource pool corresponding to the identifier of the request kernel;
[0075] Based on the first bitmap, determine the currently available word line resources in the target preset resource pool;
[0076] If the number of currently available word lines in the target preset resource pool is greater than or equal to the number of requested resources, the number of currently available word lines in the target preset resource pool that are the number of requested resources will be allocated to the request kernel.
[0077] If the number of currently available word line resources in the target preset resource pool is less than the number of requested resources, the currently available word line resources in another preset resource pool corresponding to other request kernels will be allocated to the request kernel.
[0078] Specifically, when allocating resources to a requesting kernel, the first mapping relationship is obtained first. The first mapping relationship is used to characterize the correspondence between each kernel and the preset resource pool. The preset resource pool corresponding to the requesting kernel is determined according to the first mapping relationship. Then, according to the first mapping, the currently available word line resources in the preset resource pool corresponding to the requesting kernel are determined, so that the currently available word line resources in the preset resource pool corresponding to the requesting kernel are allocated to the requesting kernel first.
[0079] If the number of currently available word lines in the preset resource pool corresponding to the requesting kernel (identifier) meets the resource request requirements (at this time, the number of currently available word lines in the preset resource pool corresponding to the requesting kernel is greater than or equal to the number of requested resources), then the first available word line resource in the corresponding preset resource pool is allocated to the requesting kernel. If the number of currently available word lines in the preset resource pool corresponding to the requesting kernel (identifier) does not meet the resource request requirements (at this time, the number of currently available word lines in the preset resource pool corresponding to the requesting kernel is 0 or less than the number of requested resources), then available word lines need to be obtained from the preset resource pools of other kernels.
[0080] For example, if kernel 1 needs to request 3 word lines, but its default resource pool only has 1 available word line resource remaining (e.g., 1-7), then it will iteratively search the default resource pool 2 of kernel 2 for any available word lines (e.g., 1-14). If default resource pool 2 also only has one available word line, then it will continue searching the default resource pool 3 of kernel 3 for any available word lines. If default resource pool 3 has 5 available word lines: 1-17, 1-18...1-21, then 1-7, 1-14, and 1-17 will be selected and allocated to kernel 1. In other words, when the default resource pool of a certain kernel cannot meet the resource request, for the insufficient portion, it can iteratively search the default resource pools of other requesting kernels for the most available available word line resource at the beginning of the list to allocate to the current requesting kernel, thus satisfying the current kernel's resource request. In this way, the distance between available word line resources allocated to the requesting kernel is shorter, thereby shortening the time for the requesting kernel to write complete data on the word line.
[0081] In this embodiment, word line resources are allocated to the requesting kernel based on the target preset resource pool corresponding to the first bit diagram and the identifier of the requesting kernel. Available word line resources are preferentially allocated from the target preset resource pool. If the available word line resources in the target preset resource pool are insufficient, the nearest available word line resource is searched from the preset resource pools corresponding to other kernels for allocation. The word line resources in this preset resource pool are resources within a super word line. Therefore, in a single SWL write task, each core collaborates to dynamically acquire word line resources, improving performance in handling high-concurrency write tasks and avoiding extreme load imbalance problems.
[0082] Following the previous embodiment, in one feasible implementation, the above resource allocation method further includes:
[0083] Record the identifier of the other preset resource pool;
[0084] If the number of available wordline resources in the target preset resource pool corresponding to the next request kernel is less than the number of requested resources, available wordline resources are searched and allocated according to the identifier of the other preset resource pool.
[0085] Specifically, when the available word line resources in the preset resource pool corresponding to a certain requesting kernel A cannot meet the requesting kernel's own resource requirements, it obtains another preset resource pool D corresponding to another kernel D. d After the available word line resources are available, the resource allocation device will record the other preset resource pool D. d The identifier is used to identify kernel D. It can be understood that after a sequential search, the available word line resources in the preset resource pool corresponding to kernel D are allocated to kernel A. Therefore, the preset resource pools corresponding to kernels B and C will have no available word line resources. When the available word line resources in the preset resource pool corresponding to kernel B cannot meet the resource requirements of the requesting kernel B, the previously recorded D can be used directly. d The system will then begin searching other preset resource pools for available wordline resources to quickly acquire and allocate them.
[0086] In this embodiment, when the resource requests of the current requesting kernel are satisfied by using the preset resource pool resources of other requesting kernels, the identifier of another preset resource pool that has available word line resources for allocation is recorded. This allows the kernel to quickly find available word line resources for allocation based on the recorded identifier of another preset resource pool when the current requesting kernel's own preset resource pool cannot meet the requesting resource requirements in the next instance, thereby improving resource allocation efficiency.
[0087] In this application, when processing a resource request for a new SWL write task, the first bit map corresponding to the SWL write task is first obtained. Based on this first bit map, the currently available word line resources are determined. Then, the available word line resources in the preset resource pool corresponding to the requesting kernel are allocated. This achieves dynamic and balanced allocation of word line resources in the super word line. Similarly, the dynamic allocation of word line resources for multiple SWL write tasks of a NAND SSD can improve the overall write performance of the NAND SSD, increase resource utilization, meet the demands of high-concurrency write tasks, and effectively avoid extreme load imbalance problems.
[0088] In one embodiment of this application, a SWL write task corresponds to a first bitmap and a second bitmap, used to record the currently available word line resources in the super word line and the data write status (data not full / data full) of the currently allocated word line resources, respectively. After allocating word line resources to the requesting kernel according to the first bitmap and the target preset resource pool corresponding to the identifier of the requesting kernel, the resource allocation method further includes:
[0089] Update the second bitmap, which is used to represent the data write status of the currently allocated word line resources;
[0090] If the difference between the number of tasks currently in execution and the total number of tasks is less than the task threshold, determine the first task to be executed among the tasks currently in execution.
[0091] Based on the second bitmap, obtain the data write status of the word line resource corresponding to the first task;
[0092] If there is a first word line resource in the word line resource corresponding to the first task that is not full of data, fill data is written into the first word line resource.
[0093] Specifically, the second bitmap is used to represent the data write status of currently allocated word line resources. The first bitmap shows which word line resources in the super word line are currently allocated and busy, and which are unallocated and available. The second bitmap further shows which of the currently allocated word line resources in the super word line have completed data reception and are fully loaded, and which have not. After allocating word line resources to the requesting kernel in response to a resource request, the data write status of the allocated word line resources can be updated to monitor the data write status of allocated word line resources for other tasks, facilitating timely identification of extreme load imbalance issues.
[0094] Before allocating word line resources in response to a SWL write task, if the difference between the number of tasks currently in execution (or the number of SWL tasks in the task execution queue) and the total task capacity is less than a preset threshold (at which point the possibility of IO request blocking is high), the task at the front of the currently executing tasks (the SWL task in the earliest position) is first identified as the first task. Based on the second bitmap, the data writing status of the word line resources corresponding to the first task is then checked. The total task capacity can be determined based on the number of super word lines. If the first task has not completed normally and cannot release resources, causing a backlog of tasks that is about to exceed the total task capacity, timely processing is required. When the resource allocation device detects that there is a first word line resource in the word line resources corresponding to the first task that is not fully written, the reason why the task has not completed is that the first word line resource is not fully filled with data. Therefore, filling the first word line resource with data can quickly handle extreme load imbalance problems.
[0095] For example, the preset task threshold is 1 or 2. When all WLs in the second-to-last SWL have been allocated or the last SWL has started allocating WLs, the resource allocation device checks whether there are any WLs with insufficient data in the first SWL write task based on the second bitmap of the first SWL write task. If not, the check is stopped; if they exist, it means that the current state is in an extreme load imbalance and programming cannot be completed. Dummy data is then added to the WLs with insufficient data in the first SWL write task. After all the WLs with insufficient data in the first SWL write task have been filled with dummy data, the programming instruction is sent. At this point, the first SWL write task can complete the programming, that is, the execution is completed and the resources are released.
[0096] Following the previous embodiment, in one feasible implementation, the above-mentioned updating of the second bitmap includes:
[0097] Check the data write status of currently allocated word line resources;
[0098] Based on the data writing status of the currently allocated word line resources, the bit parameters of the currently allocated word line resources that are in the data full state are set to 1 in the second bitmap, and the bit parameters of the currently allocated word line resources that are in the data incomplete state are set to 0 in the second bitmap.
[0099] Specifically, the resource allocation device can initialize the second bitmap before starting the resource allocation task and update the second bitmap after word line resource allocation. Each bit in the second bitmap corresponds to a word line. If the parameter of a bit is set to 1, it indicates that the corresponding word line has completed data reception and is in a data-full state. If the parameter of a bit is set to 0, it indicates that the corresponding word line has not completed data reception and is in a data-incomplete state. After allocating word line resources in response to a resource request, the resource allocation device can detect the data writing status of the corresponding word line resources for multiple tasks and update the bitmap according to the data writing status of the currently allocated word line resources.
[0100] In this embodiment, by setting the parameters of each bit in the second bitmap, the data writing status of the currently allocated word line resources is statistically analyzed and updated, providing accurate reference data for subsequent detection of extreme load balancing, so as to handle extreme load balancing problems in a timely manner.
[0101] Following the previous embodiment, in one feasible implementation, the above resource allocation method further includes:
[0102] Establish a second mapping relationship, which is used to represent the correspondence between each requesting kernel and the currently allocated word line resources;
[0103] The step of writing padding data into the first word line resource includes:
[0104] Based on the second mapping relationship, determine the target request kernel to which the first word line resource belongs;
[0105] The target request kernel writes the padding data into the first word line resource.
[0106] Specifically, after the resource allocation device allocates word line resources to requesting kernels, a second mapping relationship is established between each kernel and its allocated word line resources. This mapping is recorded to facilitate subsequent inter-core interactions and rapid handling of extreme load imbalances. For example, if a word line in an SWL task T is found to be in a state of incomplete data writing, preventing the task from programming and releasing data, the target kernel to which the incomplete word line resource (first word line resource) belongs is located based on the second mapping relationship. This target kernel has the permission to write data to the first word line resource. The target kernel then writes dummy data to the first word line resource to fill it, allowing the task T to program normally. Subsequent SWL tasks can then receive programming commands and program sequentially. This allows for rapid handling of extreme load imbalances and avoids I / O request blocking.
[0107] In this embodiment, a second mapping relationship is established between each kernel and its allocated word line resources. The correspondence between the allocated word line resources and the kernel is recorded to facilitate subsequent inter-kernel interaction and rapid handling of extreme load imbalance problems.
[0108] Following the previous embodiment, in one feasible implementation, the current task receiving strategy can be adjusted according to the second mapping relationship to further ensure load balancing among the kernels. For example, based on the second mapping relationship, the number of word line resources currently occupied by each kernel can be compared. If a task in a certain kernel occupies more resources, the current task receiving strategy can be adjusted to prioritize the kernels occupying fewer word line resources to receive tasks sent by the host computer, thereby achieving proactive kernel load balancing and effectively reducing the probability of CPU idling.
[0109] Reference Figure 2 , Figure 2 This is a partial logical diagram of the resource allocation method described in one embodiment of this application. For example... Figure 2 As shown, each kernel receives a task from the host computer and sends a resource request to the resource allocation device based on the amount of resources required in the task. In this embodiment, the resource allocation device selects resources in a super word line to allocate resources to each kernel, meaning multiple kernels write data to the resources of the same super word line to collaboratively complete a SWL write task. When an SWL write task is initialized, the resource allocation device allocates resources for that SWL write task by first initializing the first bitmap and the second bitmap (at this time, before resource allocation begins, initializing the first bitmap and the second bitmap means setting all bits in the first bitmap and the second bitmap to 0), and then allocating resources to each kernel according to the first bitmap. After each kernel obtains the resources, it writes data into the acquired resources. The resource allocation device will also update the bit parameters in the first bitmap and the second bitmap in the next resource allocation task. Thus, the word line resources are dynamically allocated according to the set bitmap, achieving inter-core load balancing, that is, balancing the kernel's tasks and the allocated resources, avoiding extreme load imbalance.
[0110] Reference Figure 3 , Figure 3 This is a partial data link diagram of the resource allocation method described in the embodiments of this application. For example... Figure 3 As shown, when performing resource allocation, the resource allocation device obtains the first bit map and the second bit map, as well as the request queue according to the first-in-first-out principle. For each resource request, the first bit map and the second bit map are updated, and the resource identifier allocated to the kernel of the requested resource is output to the kernel of the requested resource, so as to dynamically allocate resources to the kernel of the requested resource.
[0111] In this application, when allocating resources to each core, resources are allocated according to the order of resource requests, and an access locking mechanism is used to respond to resource requests, which can avoid service quality degradation due to write latency. Available word line resources are determined in the available word line bitmap of a super word line. Combined with the preset resource pools of each kernel, the available word line resources in the preset resource pools are allocated to the corresponding requesting kernels to achieve load balancing between cores, improve concurrent write performance, and quickly process IO requests. The available word line bitmap and the bitmap recording the data write status of the super word line are updated to facilitate dynamic allocation of word line resources to avoid extreme load imbalance and to facilitate timely detection of extreme load imbalance. When extreme load imbalance may occur, the data write status of the word line resources of the preceding task is detected, and placeholder data is filled into the word line resources of the preceding task that are not filled with data (the kernel to execute the write data is determined based on the second mapping relationship), so that the preceding task can be programmed smoothly, complete the task, release resources, and avoid request blocking.
[0112] The embodiments in this application achieve multi-core load balancing by dynamically allocating resources based on bitmaps, effectively avoiding extreme load imbalances in the system. They also allow for timely detection and rapid handling of extreme load imbalances. This improves the write performance of the flash drive, avoids write latency-induced quality of service degradation, significantly reduces the possibility of I / O blocking, and facilitates the prevention and timely resolution of extreme load imbalances.
[0113] Reference Figure 4 , Figure 4 This is a schematic diagram of the framework of the resource allocation device described in one embodiment of this application. Figure 4 As shown, in one embodiment of this application, the resource allocation device 400 includes:
[0114] The acquisition module 401 is used to acquire the first bit image; the first bit image is used to represent the availability status of word line resources;
[0115] The receiving module 402 is used to receive resource requests; the resource request includes an identifier of the requesting kernel;
[0116] The allocation module 403 is used to respond to the resource request by allocating word line resources to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel.
[0117] In this embodiment, the resource allocation device acquires a first bitmap; the first bitmap is used to characterize the availability status of word line resources; receives a resource request; the resource request includes the identifier of the requesting kernel; in response to the resource request, it allocates word line resources to the requesting kernel according to the preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel; the preset resource pool corresponding to the identifier of the requesting kernel is used to pre-record the resources to be allocated to the requesting kernel, that is, the word line resources to be allocated to each kernel are pre-set for a SWL. When allocating resources, based on the first bitmap and the preset resource pool corresponding to the requesting kernel, available word line resources are allocated to the requesting kernel so that each core in a SWL write task contributes and the degree of contribution is equal. In this way, load balancing between cores can be achieved, avoiding the problem of extreme load imbalance.
[0118] This application contains a limited description of the device embodiments; for details, please refer to the above method embodiments, which will not be repeated here.
[0119] In one embodiment of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the resource allocation method described above.
[0120] In one embodiment of this application, a non-volatile storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the resource allocation method as described in the above embodiments.
[0121] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0122] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0124] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0126] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0127] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0128] The resource allocation method, apparatus, electronic device, and medium provided above have been described in detail. Specific examples have been used to illustrate the principles and embodiments of this application. The description of the embodiments above is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in specific embodiments and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A resource allocation method, characterized in that, The method includes: Obtain the first image; the first image is used to represent the availability status of word line resources; Receive resource requests; the resource requests include the identifier of the requesting kernel; In response to the resource request, word line resources are allocated to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel.
2. The resource allocation method according to claim 1, characterized in that, The resource request also includes the requested resource quantity; in response to the resource request, allocating word line resources to the request kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel includes: Obtain the first mapping relationship, which is used to represent the correspondence between each kernel and the preset resource pool; Based on the first mapping relationship, determine the target preset resource pool corresponding to the identifier of the request kernel; Based on the first bitmap, determine the currently available word line resources in the target preset resource pool; If the number of currently available word lines in the target preset resource pool is greater than or equal to the number of requested resources, the number of currently available word lines in the target preset resource pool that are the number of requested resources will be allocated to the request kernel. If the number of currently available word line resources in the target preset resource pool is less than the number of requested resources, the currently available word line resources in another preset resource pool corresponding to other request kernels will be allocated to the request kernel.
3. The resource allocation method according to claim 2, characterized in that, The method further includes: Record the identifier of the other preset resource pool; If the number of available wordline resources in the target preset resource pool corresponding to the next request kernel is less than the number of requested resources, available wordline resources are searched and allocated according to the identifier of the other preset resource pool.
4. The resource allocation method according to claim 1, characterized in that, After allocating word line resources to the request kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the request kernel, the method further includes: Update the second bitmap, which is used to represent the data write status of the currently allocated word line resources; If the difference between the number of tasks currently in execution and the total number of tasks is less than the task threshold, determine the first task to be executed among the tasks currently in execution. Based on the second bitmap, obtain the data write status of the word line resource corresponding to the first task; If there is a first word line resource in the word line resource corresponding to the first task that is not full of data, fill data is written into the first word line resource.
5. The resource allocation method according to claim 4, characterized in that, The method further includes: Establish a second mapping relationship, which is used to represent the correspondence between each requesting kernel and the currently allocated word line resources; The step of writing padding data into the first word line resource includes: Based on the second mapping relationship, determine the target request kernel to which the first word line resource belongs; The target request kernel writes the padding data into the first word line resource.
6. The resource allocation method according to claim 4, characterized in that, The update of the second bitmap includes: Check the data write status of currently allocated word line resources; Based on the data writing status of the currently allocated word line resources, the bit parameters of the currently allocated word line resources that are in the data full state are set to 1 in the second bitmap, and the bit parameters of the currently allocated word line resources that are in the data incomplete state are set to 0 in the second bitmap.
7. The resource allocation method according to any one of claims 1-6, characterized in that, The resource request also includes a request time; after receiving the resource request, the method further includes: The resource requests are arranged in the request queue according to the order of their request times. Retrieve the resource request with the earliest request time from the current request queue and respond to the resource request using an access locking mechanism.
8. A resource allocation device, characterized in that, The device includes: The acquisition module is used to acquire the first bit image; the first bit image is used to represent the availability status of word line resources. A receiving module is used to receive resource requests; the resource request includes the identifier of the requesting kernel; The allocation module is used to respond to the resource request by allocating word line resources to the requesting kernel according to the target preset resource pool corresponding to the first bitmap and the identifier of the requesting kernel.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the resource allocation method as described in any one of claims 1-7.
10. A non-volatile storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the resource allocation method as described in any one of claims 1-7.