A multi-core collaborative task management method for SSD garbage collection
By initializing the multi-core processor structure in the SSD controller and designing a task allocation method based on core load capacity, the problem of garbage collection task coordination in a multi-core environment is solved, and efficient garbage collection, optimized response time, extended equipment life and reduced power consumption are achieved.
Patent Information
- Application Number
- CN202411943741.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-01
AI Technical Summary
In a multi-core environment, how to efficiently coordinate multiple cores for SSD garbage collection tasks, improve system performance and extend equipment service life.
By initializing the multi-core processor structure in the SSD controller, identifying the number of available cores and setting the master core and slave cores, the master core is responsible for garbage collection task decomposition, task allocation and global scheduling, and the slave core performs the allocated subtasks. Design a task allocation method based on core load capacity, assign subtasks to different processor cores, and optimize task execution order through priority scheduling.
It realizes efficient garbage collection operations, optimizes system response time, extends the service life of SSD, reduces power consumption, and improves the reliability of storage devices.
Smart Images

Figure CN119739486A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage, and in particular to a multi-core collaborative task management method for SSD garbage collection. Background Art
[0002] With the development of science and technology, especially the development of aerospace, machine vision and other technologies, whether it is satellite-borne, ship-borne or industrial measurement technology, the digital images taken by high-speed digital cameras urgently need a large-capacity, high-speed and high-reliability image storage system. With the emergence and widespread use of NAND Flash, SSD based on NAND Flash can meet the storage needs of high-speed digital cameras due to its higher reliability, better performance and lower energy consumption.
[0003] In solid-state drives (SSDs), garbage collection (GC) is one of the key technologies to maintain their performance and lifespan. The storage unit of an SSD is made up of NAND flash memory, which has the characteristic of having to be fully written before erasing. This means that whenever an SSD performs a write operation, some old data may need to be erased to make room, a process known as garbage collection. However, the garbage collection process can cause the performance of the SSD to degrade, especially when multiple tasks are written concurrently, as the garbage collection load increases and affects the system response time. Modern multi-core processors are widely used in SSD controller design, and their parallel processing capabilities can be used to improve the efficiency of garbage collection. However, how to efficiently coordinate multiple cores to perform garbage collection tasks in a multi-core environment remains a challenge. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide an SSD garbage collection multi-core collaborative task management method, which realizes multi-core collaborative work by reasonably allocating garbage collection tasks, thereby improving system performance and extending equipment service life.
[0005] In order to solve the technical problem, the technical solution adopted by the present invention is: a SSD garbage collection multi-core collaborative task management method, comprising the following steps: S101, initialization of the multi-core processor structure. When the SSD controller is initialized, the number of available cores of the multi-core processor is identified. Each core has an independent computing unit and data cache. One core is set as the master core and the others are slave cores. A task queue and a task manager are assigned to each core. The master core is responsible for garbage collection task decomposition, task allocation, and global scheduling, and the slave core is responsible for executing the assigned garbage collection subtasks. S102, task division and queue management, the garbage collection task in the SSD is divided into multiple subtasks by the main core, each subtask contains the physical address of the data block that needs to be garbage collected, the valid data ratio, the wear degree of the data block, the data shelf life of the data block, and the recycling priority; When dividing tasks, the workload weight coefficient of the subtask is calculated according to the task complexity, and then the workload of the subtask is calculated according to the workload weight coefficient of the subtask; S103, task allocation, designing an allocation method based on core load capacity to allocate the divided subtasks to different processor cores. The allocation method based on core load capacity refers to calculating the load capacity of each core based on the workload allocated to it. The larger the core load capacity is, the more idle the core is, and the task is allocated first. S104, task execution and feedback. When a slave core completes its assigned subtask, it feeds back a completion signal to the task queue, triggering the next round of task allocation and adjustment, and writing the task completion time, task resource consumption, and number of errors into the task log for storage.
[0006] Furthermore, the formula for calculating the workload weight coefficient of the subtask according to the task complexity is: , in represents the workload weight coefficient of the i-th subtask, It represents the time complexity, represents the space complexity, , is an adjustable parameter; The formula for calculating the workload of a subtask based on the workload weight coefficient of the subtask is: , in represents the workload of the ith subtask, n represents the total number of subtasks, and W represents the total workload; The formula for calculating the load capacity based on the workload assigned to each core is: , in represents the load capacity of core j, Represents the workload assigned to core j, which is the sum of the workloads of subtasks assigned to core j.
[0007] Furthermore, the actual processing time of the subtask is used to represent the time complexity , using the measured subtasks’ CPU resource consumption to characterize the space complexity .
[0008] Furthermore, when allocating tasks, subtasks with high priority are preferentially allocated to idle or low-load cores. When the load is high, priority scheduling is used to optimize the order of task execution. The above low load and high load are determined by the core load capacity. If the core load capacity is greater than the set value T1, the load is considered low. If the core load capacity is less than the set value T2, it is considered high.
[0009] Furthermore, when the load is high, priority scheduling is used to optimize the order of task execution: high-priority tasks preempt the core resources of low-priority tasks when allocated, and the preemption operation is triggered by an interrupt.
[0010] Furthermore, priorities are set according to task urgency and data block status: the task priority for read offset is A, the task priority for hot tasks with expired data shelf life is B, the task priority for data block wear higher than the set value is C, the task priority for valid data ratio lower than the set value is D, and the task priority for ordinary recovery is E, A>B>C>D>E.
[0011] Furthermore, after the task completion time, task resource consumption, and number of errors are written into the task log and saved, the task log is analyzed regularly. For tasks that occupy core resources more frequently than the set requirements, their priority is lowered. If the speed at which a core executes tasks is lower than the set requirements, its load capacity level is lowered, and data verification is strengthened for tasks with high error rates.
[0012] Furthermore, a shared area is set between the cores of the multi-core processor, and each core has the ability to read data from the shared area. By setting up a shared area, the communication between the cores through instructions is reduced, and the data reading and writing speed is accelerated.
[0013] Furthermore, the master core and the slave core communicate with each other through a message queue mechanism.
[0014] Furthermore, in step S102, the divided subtasks are stored in the task queue of each slave core, and the slave core obtains the subtasks for processing by polling the queue.
[0015] Beneficial effects of the present invention: 1) Improved garbage collection efficiency: Through multi-core collaboration, efficient garbage collection operations are achieved, reducing performance bottlenecks caused by single-core processing.
[0016] 2) Optimized system response time: The introduction of task allocation strategy makes the system's task allocation more reasonable and effectively shortens the waiting time for garbage collection.
[0017] 3) Extend the service life of SSD: Reasonable task allocation reduces the number of garbage collection times, thereby extending the service life of SSD.
[0018] 4) Reduced power consumption: Multi-core collaboration reduces the working time of each core, thereby reducing overall power consumption.
[0019] 5) Improved reliability of storage devices: Through task allocation and load adjustment, the risk of core thermal damage and failure caused by overuse is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 Flowchart of this method. DETAILED DESCRIPTION
[0021] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.
[0022] Example 1 This embodiment discloses a SSD garbage collection multi-core collaborative task management method, such as Figure 1 As shown, the following steps are included: S101. Initialization of a multi-core processor structure.
[0023] Specifically, when the SSD controller is initialized, it identifies the number of available cores of the multi-core processor. Each core has an independent computing unit and data cache. A shared area is set between the cores to achieve data interaction between the cores and ensure high-speed communication. One core is set as the master core, and the others are slave cores. A task queue and a task manager are assigned to each core. The master core is responsible for garbage collection task decomposition, task allocation, and global scheduling. The slave core is responsible for executing the assigned garbage collection subtasks. The master core and the slave core communicate through a message queue mechanism.
[0024] S102, task division and queue management.
[0025] Specifically, the garbage collection task in the SSD is divided into multiple subtasks by the master core and stored in the task queue of each slave core. Each subtask contains information such as the physical address of the required data block, the proportion of valid data, the degree of wear of the data block, the data shelf life of the data block, and the recycling priority. The slave core obtains the subtasks through the polling queue for processing.
[0026] When dividing tasks, calculate the workload weight coefficient of subtasks according to task complexity: , in represents the workload weight coefficient of the i-th subtask, It represents the time complexity, represents the space complexity, , It is an adjustable parameter and is adjusted according to the task characteristics. In this embodiment, the actual processing time of the subtask is used to represent the time complexity. , using the measured subtasks’ CPU resource consumption to characterize the space complexity .
[0027] The formula for calculating the workload of a subtask based on the workload weight coefficient of the subtask is: , in represents the workload of the ith subtask, n represents the total number of subtasks, and W represents the total workload. When the master core assigns tasks to each slave core, each slave core counts the total amount of tasks it has been assigned. , total task volume The subtasks to which they are assigned need to be accumulated When the task processing is completed, the total task amount is reduced by the corresponding task .
[0028] S103: Task allocation.
[0029] Specifically, a distribution method based on core load capacity is designed to distribute the divided subtasks to different processor cores. The distribution method based on core load capacity means that the load capacity of each core is calculated based on the workload assigned to it. The main core will give priority to allocating more subtasks to idle cores or cores with large load capacity. The core load capacity represents the task carrying capacity of the core, which is measured by the following formula: , in represents the load capacity of core j, Indicates the workload assigned to core j, which is the sum of the subtask workloads assigned to core j. The larger the core load capacity, the more idle the core is, and the tasks are assigned first.
[0030] In addition, higher priority subtasks will be preferentially assigned to idle or lightly loaded cores to reduce task latency, and priority scheduling will be used to optimize task execution order under high load.
[0031] In this embodiment, the task priority is set according to the task urgency and the data block status. The task priority of read offset is A, the hot task priority of expired data shelf life is B, the task priority of data block wear higher than the set value is C, the task priority of valid data ratio lower than the set value is D, and the ordinary recovery task priority is E, A>B>C>D>E.
[0032] High-priority tasks can preempt the core resources of low-priority tasks during task allocation. The preemption operation is triggered by an interrupt to ensure that the higher-priority task is processed first.
[0033] S104. Task execution and feedback.
[0034] Specifically, when a core completes a task, it feeds back a completion signal to the task queue, triggering the next round of task allocation and adjustment. Information such as task completion time, task resource consumption, and number of errors is written into the task log for storage. Every 24 hours, based on the collected log data, the priority of tasks that frequently occupy resources (occupancy frequency is greater than the set requirements) is reduced through algorithm improvement. If a core executes tasks too slowly (execution speed is less than the set requirements), its load capacity is downgraded, and tasks are preferentially assigned to other cores with faster processing speeds. Data verification is strengthened for tasks with high error rates.
[0035] In the above description, both low load and high load are determined by the core load capacity. If the core load capacity is greater than the set value T1, the load is considered to be low. If the core load capacity is less than the set value T2, the load is considered to be high.
[0036] The method described in this embodiment achieves efficient garbage collection by allocating garbage collection tasks to multiple processor cores and using a multi-core collaborative management strategy. Specifically, the present invention manages garbage collection tasks in a refined manner by establishing a task queue and a task allocation mechanism to avoid performance bottlenecks caused by single core overload or task conflicts. At the same time, a task allocation strategy is designed to monitor and adjust the workload of each core in real time to ensure the smooth operation of the system.
[0037] The above description is only the basic principle and preferred embodiments of the present invention. Improvements and substitutions made by those skilled in the art based on the present invention belong to the protection scope of the present invention.
Claims
1. A multi-core collaborative task management method for SSD garbage collection, characterized by: The following steps are involved: S101, initialization of the multi-core processor structure. When the SSD controller is initialized, the number of available cores of the multi-core processor is identified. Each core has an independent computing unit and data cache. One core is set as the master core and the others are slave cores. A task queue and a task manager are assigned to each core. The master core is responsible for garbage collection task decomposition, task allocation, and global scheduling, and the slave core is responsible for executing the assigned garbage collection subtasks. S102, task division and queue management, the garbage collection task in the SSD is divided into multiple subtasks by the main core, each subtask contains the physical address of the data block that needs to be garbage collected, the valid data ratio, the wear degree of the data block, the data shelf life of the data block, and the recycling priority; When dividing tasks, the workload weight coefficient of the subtask is calculated according to the task complexity, and then the workload of the subtask is calculated according to the workload weight coefficient of the subtask; S103, task allocation, designing an allocation method based on core load capacity to allocate the divided subtasks to different processor cores. The allocation method based on core load capacity refers to calculating the load capacity of each core based on the workload allocated to it. The larger the core load capacity is, the more idle the core is, and the task is allocated first. S104, task execution and feedback. When a slave core completes its assigned subtask, it feeds back a completion signal to the task queue, triggering the next round of task allocation and adjustment, and writing the task completion time, task resource consumption, and number of errors into the task log for storage.
2. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: The formula for calculating the workload weight coefficient of a subtask based on task complexity is: , in represents the workload weight coefficient of the i-th subtask, It represents the time complexity, represents the space complexity, , is an adjustable parameter; The formula for calculating the workload of a subtask based on the workload weight coefficient of the subtask is: , in represents the workload of the ith subtask, n represents the total number of subtasks, and W represents the total workload; The formula for calculating the load capacity based on the workload assigned to each core is: , in represents the load capacity of core j, Represents the workload assigned to core j, which is the sum of the workloads of subtasks assigned to core j.
3. The SSD garbage collection multi-core collaborative task management method according to claim 2, characterized in that: The time complexity is represented by the actual processing time of the subtask , using the measured subtasks’ CPU resource consumption to characterize the space complexity .
4. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: When allocating tasks, subtasks with high priorities are preferentially allocated to idle or lightly loaded cores. When the load is high, priority scheduling is used to optimize the order of task execution.
5. The SSD garbage collection multi-core collaborative task management method according to claim 4, characterized in that: Under high load, priority scheduling is used to optimize the order of task execution: high-priority tasks preempt the core resources of low-priority tasks when allocated, and the preemption operation is triggered by interrupts.
6. The SSD garbage collection multi-core collaborative task management method according to claim 4, characterized in that: Set priorities based on task urgency and data block status. The priority of read offset tasks is A, the priority of hot tasks with expired data is B, the priority of tasks with data block wear higher than the set value is C, the priority of tasks with valid data ratio lower than the set value is D, and the priority of ordinary recovery tasks is E. A>B>C>D>E.
7. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: After writing the task completion time, task resource consumption, and number of errors into the task log and saving it, the task log is analyzed regularly. For tasks that occupy core resources more frequently than the set requirements, their priority is lowered. If a core executes tasks at a speed lower than the set requirements, its load capacity level is lowered, and data verification is strengthened for tasks with high error rates.
8. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: A shared area is set between the cores of a multi-core processor, and each core has the ability to read data from the shared area.
9. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: The master core and the slave core communicate through a message queue mechanism.
10. The SSD garbage collection multi-core collaborative task management method according to claim 1, characterized in that: In step S102, the divided subtasks are stored in the task queue of each slave core, and the slave core obtains the subtasks for processing by polling the queue.
Citation Information
Cited By
Real-time control multi-core efficient synchronization method
CN120276879A
Solid state disk high-speed garbage collection processing method and device, medium and equipment
CN121070256A