Submission queue scheduling method and device, solid state disk and readable storage medium
By binding a successful call flag to the submission queue in the NVMe SSD and monitoring the status of the completed queue, the problem of uneven queue scheduling is solved, and more stable queue resource management is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-03
AI Technical Summary
In NVMe SSDs, when multiple commit queues are mapped to a single completion queue, the queue scheduling becomes unbalanced, which may cause a certain commit queue to be left unscheduled, affecting the hard drive failure rate.
In a round of polling scheduling, the success flag of the target submission queue is bound to it, the queue set is traversed to determine whether the scheduling is complete, command calls for competing submission queues are blocked or responded to, and the status of the completed queues is monitored to adjust the scheduling.
It improves the balance of submission queue scheduling, avoids disorderly preemption of queue resources, and stabilizes the operating status of the hard disk.
Smart Images

Figure CN121785535A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, and in particular to a submission queue scheduling method, apparatus, solid-state drive, and readable storage medium. Background Technology
[0002] The NVMe protocol supports simultaneous round-robin scheduling of multiple commit queues (SQs), allows commit queues to have different priorities, and supports mapping multiple commit queues to a single completion queue (CQ). However, when implementing commit queue scheduling, many NVMe SSD manufacturers encounter issues. When multiple commit queues are mapped to a single completion queue for processing, the scheduling process becomes problematic because the commit queues compete for completion queue resources. This can lead to situations where some commit queues are never scheduled, resulting in insufficient balance in commit queue scheduling and increasing the risk of hard drive failure. Summary of the Invention
[0003] In view of this, the purpose of this application is to overcome the shortcomings of the prior art and provide a submission queue scheduling method, the method being applied to a solid-state drive (SSD), wherein the SSD is designed with a submission queue and a completion queue, the method comprising: In a round of polling scheduling, when a command in the target submission queue is invoked and the result of the invocation is placed in the corresponding completion queue, a success flag is bound to the target submission queue. Iterate through the success flag binding status of each submission queue in the queue set to determine whether the current round of polling scheduling has been completed; If the current round of polling scheduling is completed, the next round of polling scheduling will be executed.
[0004] In one embodiment, the set of submission queues includes multiple competing submission queues mapped to the same completion queue, and the method further includes: In a round of polling scheduling, it is checked whether each of the competition submission queues is bound to the call success identifier; If the contention submission queue is bound to the call success identifier, then command call requests from the contention submission queue are blocked. If the contention submission queue is not bound to the call success identifier, then the command call request of the contention submission queue is responded to, and the command in the contention submission queue is invoked.
[0005] In one embodiment, the method further includes: In a round of polling scheduling, in response to a command storage request for the target submission queue bound to the call success identifier, the command corresponding to the command storage request is stored in the target submission queue; Command call requests to the target submission queue are blocked until the next round of polling scheduling starts.
[0006] In one embodiment, the step of traversing the call success flag binding status of each submission queue in the submission queue set and determining whether the current round of polling scheduling has been completed includes: Iterate through the call success identifier binding status of each submission queue in the submission queue set. If each submission queue is bound to the call success identifier, then the current round of polling scheduling is completed. If there is a waiting submission queue that is not bound to the call success identifier, then the status of the waiting submission queue is used to determine whether the current round of polling scheduling has been completed.
[0007] In one embodiment, the step of determining whether the current round of polling scheduling has been completed based on the queue status of the waiting submission queue includes: If the queue status of the queue waiting to be submitted is invalid, then the current round of polling scheduling is completed. If the queue status of the waiting-to-submit queue is valid, then the commands in the waiting-to-submit queue will continue to be invoked.
[0008] In one embodiment, the method further includes: In a round of polling scheduling, monitor the storage status or response latency of the target completion queue; If the storage status is full or the response delay exceeds the threshold, then the command call processing of all submission queues corresponding to the target completion queue is suspended.
[0009] In one embodiment, the step of executing the next round of polling scheduling if it is determined that the current round of polling scheduling has been completed includes: If the current round of polling scheduling is completed, the binding between all submission queues in the submission queue set and the call success identifier is removed, and the next round of polling scheduling is executed.
[0010] This application also provides a submission queue scheduling device, the submission queue scheduling device comprising: The binding module is used to bind a call success flag to the target submission queue when a command in the target submission queue in the submission queue set is called and the call result is placed into the corresponding completion queue during a round of polling scheduling. The judgment module is used to traverse the call success identifier binding status of each submission queue in the submission queue set and determine whether the current round of polling scheduling has been completed. The determination module is used to execute the next round of polling scheduling if it is determined that the current round of polling scheduling has been completed.
[0011] This application also provides a solid-state drive, which includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the above-described submission queue scheduling method.
[0012] This application also provides a computer-readable storage medium storing a computer program that, when run on a processor, executes the above-described submission queue scheduling method.
[0013] The embodiments of this application have the following beneficial effects: In this embodiment of the application, during a round of polling scheduling, when a command in a target submission queue in the submission queue set is invoked and the invocation result is placed in the corresponding completion queue, a success flag is bound to the target submission queue. The success flag binding status of each submission queue in the submission queue set is traversed to determine whether this round of polling scheduling is complete. If it is determined that this round of polling scheduling is complete, the next round of polling scheduling is executed. By using the submission queue invocation completion and success flags during a round of polling scheduling, it is possible to determine which submission queues have not been invoked, and then invoke them accordingly, avoiding disorderly contention for completion queue resources among multiple submission queues and improving the balance of submission queue scheduling. Attached Figure Description
[0014] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and therefore should not be considered as a limitation on the scope of protection of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 A flowchart illustrating the first embodiment of the submission queue scheduling method provided in this application; Figure 2 A flowchart illustrating a second embodiment of the submission queue scheduling method provided in this application; Figure 3 A flowchart illustrating a third embodiment of the submission queue scheduling method provided in this application; Figure 4 A flowchart illustrating the fourth embodiment of the submission queue scheduling method provided in this application; Figure 5 A flowchart illustrating the fifth embodiment of the submission queue scheduling method provided in this application; Figure 6 A flowchart illustrating the polling scheduling process provided for this application; Figure 7 A schematic diagram of the submission queue scheduling device provided in this application. Detailed Implementation
[0016] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0017] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0018] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0019] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0020] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0021] It is understood that the method of this application is applied to solid-state drives (SSDs), which are designed with commit queues and completion queues. The SSD can be an NVMe-based SSD, and this is not limited to it. For ease of explanation, the following embodiments use SSDs as an example for detailed description.
[0022] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0023] Please refer to Figure 1 , Figure 1This is a flowchart illustrating a first embodiment of the submission queue scheduling method provided in this application. The method includes: Step S101: In a round of polling scheduling, when a command in the target submission queue in the submission queue set is invoked and the invocation result is placed into the corresponding completion queue, the invocation success flag is bound to the target submission queue.
[0024] In this embodiment, the solid-state drive (SSD) is communicatively connected to the host (such as the CPU of a computer). The host submits I / O commands or management commands to the SSD and stores these commands in the SSD's submission queue. This allows the SSD to invoke the operations required by these commands (such as read, write, erase, etc.). The SSD initiates a round of polling scheduling based on a set time. In this round, when a command in the target submission queue of the submission queue set is invoked by the SSD and the result is placed in the corresponding completion queue, the SSD binds a success flag to the target submission queue.
[0025] In one embodiment, the host continuously submits I / O commands or management commands to the solid-state drive (SSD) and stores the commands in the SSD's submission queue. After a preset time (which is usually very short), the SSD initiates a round of polling scheduling to call the commands in each submission queue in the submission queue set. For submission queues that have been successfully called, they are bound to a call success flag.
[0026] In one embodiment, each submission queue is assigned an SQ MASK signal bit, which is used to indicate whether the submission queue has been successfully invoked. When the submission queue has not been invoked, the SQ MASK signal bit corresponding to the submission queue is set to 0. When the submission queue has been successfully invoked, the SQ MASK signal bit corresponding to the submission queue is set to 1. This is equivalent to binding the successfully invoked submission queue with the successful invocation flag.
[0027] Step S102: Iterate through the call success identifier binding status of each submission queue in the submission queue set to determine whether the current round of polling scheduling has been completed.
[0028] In this embodiment, during a round of polling scheduling, the solid-state drive (SSD) iterates in real-time through the success flag binding status of each submission queue in the submission queue set to determine whether the current round of polling scheduling has been completed. It is understood that submission queues bound with success flags have been successfully invoked, while those without success flags have not yet been invoked. When every submission queue in the submission queue set is bound to a success flag, the current round of polling scheduling is considered complete; otherwise, it is not.
[0029] It should be noted that for submission queues that have been bound with a success flag, the SSD will not invoke commands in those queues again during this round of polling and scheduling. Instead, it will invoke commands in submission queues that have not been bound with a success flag until this round of polling and scheduling is completed.
[0030] Step S103: If it is determined that the current round of polling scheduling has been completed, then the next round of polling scheduling is executed.
[0031] In this embodiment, the solid-state drive (SSD) begins executing the next round of polling scheduling after determining that the current round of polling scheduling has been completed. It is understood that, although the successfully scheduled submission queues cannot be invoked during the current round of polling scheduling, the SSD can store new commands in these submission queues. Therefore, after determining that the current round of polling scheduling has been completed, the SSD can seamlessly begin executing the next round of polling scheduling.
[0032] In one embodiment, if it is determined that the current round of polling scheduling has been completed, the binding of all submission queues in the submission queue set to the call success flag is removed, and the next round of polling scheduling is executed. It is understood that when a submission queue is not invoked, the SQ MASK signal bit corresponding to the submission queue is set to 0; when a submission queue is successfully invoked, the SQ MASK signal bit corresponding to the submission queue is set to 1; when the SQ MASK signal bit corresponding to each submission queue in the submission queue set is set to 1, it is determined that the current round of polling scheduling has been completed. At this point, the solid-state drive sets the SQ MASK signal bit corresponding to each submission queue in the submission queue set to 0, and then executes the next round of polling scheduling.
[0033] In this embodiment, the solid-state drive (SSD) performs a round of polling scheduling. When a command in the target submission queue of the submission queue set is invoked and the result is placed in the corresponding completion queue, a success flag is bound to the target submission queue. The system iterates through the success flag binding status of each submission queue in the submission queue set to determine whether the current round of polling scheduling is complete. If the current round of polling scheduling is complete, the next round of polling scheduling is executed. By using the submission queue completion and success flags during a round of polling scheduling, it is possible to determine which submission queues have not been invoked and then invoke them accordingly. This avoids disorderly contention for completion queue resources among multiple submission queues and improves the balance of submission queue scheduling.
[0034] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the submission queue scheduling method provided in this application. The difference between the second embodiment and the first embodiment is that the submission queue set includes multiple competing submission queues mapped to the same completion queue, and the method further includes: Step S201: In a round of polling scheduling, query whether each of the competition submission queues is bound to the call success identifier.
[0035] In this embodiment, during a round of polling scheduling, the solid-state drive queries whether each contention submission queue is bound to a call success flag, that is, whether the SQ MASK signal bit corresponding to each contention submission queue is set to 1.
[0036] It should be noted that the set of submission queues includes multiple competing submission queues that are mapped to the same completion queue. That is, a portion of the submission queues in the set of submission queues share a single completion queue, and these submission queues compete for the same completion queue.
[0037] Step S202: If the contention submission queue is bound to the call success identifier, then the command call request of the contention submission queue is blocked.
[0038] In this embodiment, if the solid-state drive (SSD) determines that the contention submission queue is bound to the call success flag, it will block command call requests from the contention submission queue. It can be understood that if the contention submission queue is bound to the call success flag, it means that the contention submission queue has been successfully invoked by the SSD. If a new command is added to the contention submission queue and a command call request is sent, the SSD will directly block the command call request; that is, the SSD will not invoke any commands in the contention submission queue again in this round of polling scheduling.
[0039] Step S203: If the contention submission queue is not bound to the call success identifier, then respond to the command call request of the contention submission queue and call the command in the contention submission queue.
[0040] In this embodiment, if the solid-state drive (SSD) determines that the contention submission queue is not bound to a call success flag, it responds to the command call request of the contention submission queue and calls the command in the contention submission queue. It is understood that if the contention submission queue is not bound to a call success flag, it means that it was not successfully called by the SSD. Therefore, in this round of polling scheduling, the SSD continues to call commands in the contention submission queues that are not bound to a call success flag, while it will not call commands in the contention submission queues that are bound to a call success flag again in this round of polling scheduling. This ensures that multiple contention submission queues mapped to the same completion queue can be called in this round of polling scheduling, improving the balance of submission queue scheduling.
[0041] In this embodiment, for multiple competing commit queues mapped to the same completion queue, the solid-state drive continues to call commands in the competing commit queues that have not been successfully called in a single round-robin scheduling, while it will not call commands in the competing commit queues that have been successfully called again. This ensures that multiple competing commit queues mapped to the same completion queue can be called in this round of round-robin scheduling, thereby improving the balance of commit queue scheduling.
[0042] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a third embodiment of the submission queue scheduling method provided in this application. The difference between the third embodiment and the first to second embodiments is that the method further includes: Step S301: In a round of polling scheduling, in response to a command storage request for the target submission queue bound to the call success identifier, the command corresponding to the command storage request is stored in the target submission queue.
[0043] In this embodiment, during a round of polling scheduling, the solid-state drive (SSD) schedules commands in the submission queue while simultaneously receiving commands from the host, which need to be stored in the corresponding submission queue. It should be noted that if the command in the target submission queue bound to the success call flag has already been invoked, the target submission queue is empty. When a command storage request is made for a command in the target submission queue bound to the success call flag, the command corresponding to the command storage request is stored in the target submission queue.
[0044] Step S302: Block the command call request of the target submission queue until the next round of polling scheduling starts.
[0045] In this embodiment, although the solid-state drive stores the new command in the target submission queue bound to the call success flag, it will not call the command in the target submission queue again in this round of polling scheduling. That is, the command call request of the target submission queue is blocked until the next round of polling scheduling starts.
[0046] In this embodiment, the solid-state drive (SSD), in a round of polling scheduling, responds to a command storage request for a target commit queue bound to a successful call flag, and stores the command corresponding to the command storage request into the target commit queue. Command call requests to the target commit queue are blocked until the next round of polling scheduling begins. This avoids secondary calls to commands in the same commit queue within the same round of polling scheduling, helping to improve the balance of commit queue scheduling.
[0047] Please refer to Figure 4 , Figure 4This is a flowchart illustrating a fourth embodiment of the submission queue scheduling method provided in this application. The difference between the fourth embodiment and the first to third embodiments lies in the step of traversing the call success identifier binding status of each submission queue in the submission queue set and determining whether the current round of polling scheduling has been completed, which includes: Step S401: Iterate through the call success identifier binding status of each submission queue in the submission queue set. If each submission queue is bound to the call success identifier, then the current round of polling scheduling is completed.
[0048] In this embodiment, during a round of polling scheduling, the solid-state drive (SSD) iterates through the call success flag binding status of each commit queue in the commit queue set. If it is determined that each commit queue is bound to a call success flag, then the current round of polling scheduling is considered complete. It should be noted that the SSD is designed with multiple commit queues. In a round of polling scheduling, each commit queue stores the corresponding command. Therefore, the SSD needs to determine that each commit queue is bound to a call success flag before the current round of polling scheduling can be considered complete.
[0049] Step S402: If there is a waiting submission queue that is not bound to the call success identifier, then based on the queue status of the waiting submission queue, determine whether the current round of polling scheduling has been completed.
[0050] In this embodiment, during a round of polling scheduling, the solid-state drive (SSD) iterates through the success flag binding status of each commit queue in the commit queue set. If it determines that there are waiting commit queues not bound to a success flag, it determines whether to complete the current round of polling scheduling based on the queue status of these waiting commit queues. It should be noted that in a round of polling scheduling, if each commit queue stores the corresponding command, and it is determined that there are waiting commit queues not bound to a success flag, the current round of polling scheduling continues. When not every commit queue stores the corresponding command, meaning that some commit queues do not need to be invoked, these types of commit queues will never be bound to a success flag in this round of polling scheduling. In this case, the SSD needs to determine whether to complete the current round of polling scheduling based on the queue status of these waiting commit queues.
[0051] In one embodiment, the step of determining whether the current round of polling scheduling has been completed based on the queue status of the waiting submission queue includes: Step S4021: If the queue status of the queue waiting to submit is invalid, then it is determined that this round of polling scheduling is completed.
[0052] In this embodiment, after determining that there are pending submission queues not bound to a call success flag, the solid-state drive obtains the queue status of the pending submission queues. If the queue status of the pending submission queues is invalid, then the current round of polling scheduling is considered complete. It should be noted that an invalid status means that there is no command to be invoked in the submission queue. If the remaining pending submission queues are all invalid, then the current round of polling scheduling is considered complete.
[0053] Step S4022: If the queue status of the waiting submission queue is valid, then continue to call the commands in the waiting submission queue.
[0054] In this embodiment, after determining that there are pending commit queues not bound to a call success flag, the solid-state drive (SSD) obtains the queue status of the pending commit queues. If the queue status is valid, the SSD continues to invoke commands in the pending commit queues. It should be noted that a valid status means that there are commands to be invoked in the commit queues. If there are pending commit queues with valid status among the remaining pending commit queues, the SSD continues to invoke commands in those valid pending commit queues.
[0055] In this embodiment, the solid-state drive determines whether to complete the current round of polling scheduling based on the binding status and queue status of the call success identifier of each commit queue in the commit queue set. This avoids missing a call to a commit queue in a round of polling scheduling and helps improve the balance of commit queue scheduling.
[0056] Please refer to Figure 5 , Figure 5 This is a flowchart illustrating a fifth embodiment of the submission queue scheduling method provided in this application. The difference between the fifth embodiment and the first to fourth embodiments is that the method further includes: Step S501: In a round of polling scheduling, monitor the storage status or response delay of the target completion queue.
[0057] Step S502: If the storage status is full or the response delay exceeds the threshold, then pause the command call processing of all submission queues corresponding to the target completion queue.
[0058] In this embodiment, the solid-state drive (SSD) is designed so that a portion of the submission queues are mapped to the same completion queue. That is, the number of submission queues is greater than the number of completion queues. Therefore, during scheduling, situations may arise where the completion queue is full or there is a response delay. To address this, in a round-robin scheduling process, the SSD monitors the storage status or response delay of the target completion queue. If the storage status is full or the response delay exceeds a threshold, command processing for all submission queues corresponding to the target completion queue is paused.
[0059] For example, Submission Queue 1, Submission Queue 2, and Submission Queue 3 are all mapped to Completion Queue 1. Normally, after a command in Submission Queue 1 is invoked, the corresponding completion information is stored in Completion Queue 1. When a command in Submission Queue 2 or Submission Queue 3 is invoked, the completion information stored in Completion Queue 1 is cleared. However, due to certain special reasons, the completion information stored in Completion Queue 1 may not be cleared in time, or there may be a response delay. In this case, the SSD suspends the invocation of commands in Submission Queue 2 and Submission Queue 3 until the completion information stored in Completion Queue 1 is cleared or the response delay is resolved, after which the invocation of commands in Submission Queue 2 and Submission Queue 3 resumes. It should be noted that during this process, the SSD can also invoke the submission queues corresponding to other completion queues that do not have a full storage condition or where the response delay does not exceed the threshold.
[0060] In this embodiment, the solid-state drive monitors the storage status or response latency of the target completion queue during a round-robin scheduling process. If the storage status is full or the response latency exceeds a threshold, the command call processing of all submission queues corresponding to the target completion queue is paused. This avoids resource waste and state chaos caused by invalid scheduling attempts, thereby improving the stability of submission queue scheduling.
[0061] In one embodiment, reference Figure 6 , Figure 6 This is a flowchart illustrating the one-round polling scheduling process provided in this application. SQ1, SQ2, SQ3, and SQ4 are submission queues, and CQ1, CQ2, and CQ3 are completion queues. SQ1 and SQ2 are mapped to CQ1, SQ3 to CQ2, and SQ4 to CQ3. SQ REQ is the status flag of the submission queue, with 1 indicating validity and 0 indicating invalidity. SQ MASK is the success flag of the submission queue, with 1 indicating successful call and 0 indicating unsuccessful call. CQ FULL is the status flag of the completion queue, with 1 indicating full storage and 0 indicating not full storage.
[0062] In a round of polling, at the beginning, the SQ REQ of SQ1, SQ2, SQ3, and SQ4 are all set to 1, and the SQ MASK is all set to 0. This means that SQ1, SQ2, SQ3, and SQ4 are all in a valid state and have all been successfully called. They all need to be called once in this round of polling.
[0063] During the first scheduling, the solid-state drive responds to the call request of SQ1, invokes the command in SQ1, and stores the call result in CQ1. At this time, the command in SQ1 has been invoked, SQ REQ corresponding to SQ1 is set to 0, SQMASK corresponding to SQ1 is set to 1, and CQ FULL corresponding to SQ1 is set to 1. Since SQ1 and SQ2 are mapped to CQ1, CQ FULL corresponding to SQ2 is set to 1.
[0064] During the second scheduling, the SSD responds to the call request in SQ3, invokes the command in SQ3, and stores the call result in CQ2. At this point, the command in SQ3 has already been invoked, so the SQ REQ corresponding to SQ3 is set to 0, the SQMASK corresponding to SQ3 is set to 1, and the CQ FULL corresponding to SQ3 is set to 1. If, during this scheduling, the SSD receives the call request in SQ2, but the CQ FULL corresponding to SQ2 is set to 1, it indicates that CQ1 is full. In this case, the SSD cannot respond to the call request in SQ2 and must pause.
[0065] During the third scheduling, the SSD responds to the call request in SQ4, invokes the command in SQ4, and stores the call result in CQ3. At this point, the command in SQ4 has been invoked, so the SQ REQ corresponding to SQ4 is set to 0, the SQMASK corresponding to SQ4 is set to 1, and the CQ FULL corresponding to SQ4 is set to 1. Simultaneously, the SSD responds to the command storage requests for SQ1 and SQ3, storing the corresponding commands in SQ1 and SQ3, and setting the SQ REQ corresponding to SQ1 and SQ3 to 1. At the same time, the SSD clears the call results in CQ1 and CQ2, and sets the CQ FULL corresponding to SQ1, SQ2, and SQ3 to 0.
[0066] During the fourth scheduling, in this round-robin call, only SQ2 remains uncalled. At this time, CQ1 storage is not full, and the solid-state drive can respond to the call request of SQ2, invoke the command in SQ2, and store the call result in CQ1. At this time, the command in SQ2 has been invoked, SQ REQ corresponding to SQ2 is set to 0, SQ MASK corresponding to SQ2 is set to 1, and CQ FULL corresponding to SQ2 is set to 1.
[0067] After the fourth scheduling is completed, the solid-state drive can determine that the SQ MASKs corresponding to SQ1, SQ2, SQ3 and SQ4 are all set to 1, indicating that SQ1, SQ2, SQ3 and SQ4 have been successfully called in this round of round-robin scheduling. At this time, the solid-state drive sets the SQ MASKs corresponding to SQ1, SQ2, SQ3 and SQ4 to 0 and starts the next round of round-robin scheduling.
[0068] refer to Figure 7 , Figure 7 This is a schematic diagram of the submission queue scheduling device provided in this application. The submission queue scheduling device includes: The binding module 10 is used to bind a call success flag to the target submission queue when a command in the target submission queue in the submission queue set is called and the call result is placed into the corresponding completion queue during a round of polling scheduling.
[0069] The judgment module 20 is used to traverse the call success identifier binding status of each submission queue in the submission queue set and determine whether the current round of polling scheduling has been completed.
[0070] The determination module 30 is used to execute the next round of polling scheduling if it is determined that the current round of polling scheduling has been completed.
[0071] It is understood that the submission queue scheduling device in this embodiment corresponds to the submission queue scheduling method in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.
[0072] This application also provides a solid-state drive, exemplary of which includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to cause the solid-state drive to perform the above-described submission queue scheduling method.
[0073] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0074] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0075] This application also provides a computer storage medium for storing the computer program used in the aforementioned solid-state drive. The computer storage medium can be a readable storage medium, a non-volatile storage medium, or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0076] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0077] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0078] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a solid-state drive (a solid-state drive can be applied to smartphones, personal computers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0079] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for scheduling a submission queue, characterized in that, The method is applied to a solid-state drive (SSD), which is designed with a commit queue and a completion queue. The method includes: In a round of polling scheduling, when a command in the target submission queue in the submission queue set is invoked and the invocation result is placed in the corresponding completion queue, the invocation success flag is bound to the target submission queue; Iterate through the call success flag binding status of each submission queue in the submission queue set to determine whether this round of polling scheduling has been completed; If the current round of polling scheduling is completed, the next round of polling scheduling will be executed.
2. The submission queue scheduling method according to claim 1, characterized in that, The set of submission queues includes multiple competing submission queues mapped to the same completion queue, and the method further includes: In a round of polling scheduling, it is checked whether each of the competition submission queues is bound to the call success identifier; If the contention submission queue is bound to the call success identifier, then command call requests from the contention submission queue are blocked. If the contention submission queue is not bound to the call success identifier, then the command call request of the contention submission queue is responded to, and the command in the contention submission queue is invoked.
3. The submission queue scheduling method according to claim 1, characterized in that, The method further includes: In a round of polling scheduling, in response to a command storage request for the target submission queue bound to the call success identifier, the command corresponding to the command storage request is stored in the target submission queue; Command call requests to the target submission queue are blocked until the next round of polling scheduling starts.
4. The submission queue scheduling method according to claim 1, characterized in that, The step of iterating through the call success flag binding status of each submission queue in the submission queue set and determining whether the current round of polling scheduling has been completed includes: Iterate through the call success identifier binding status of each submission queue in the submission queue set. If each submission queue is bound to the call success identifier, then the current round of polling scheduling is completed. If there is a waiting submission queue that is not bound to the call success identifier, then the status of the waiting submission queue is used to determine whether the current round of polling scheduling has been completed.
5. The submission queue scheduling method according to claim 4, characterized in that, The step of determining whether the current round of polling scheduling has been completed based on the queue status of the waiting submission queue includes: If the queue status of the queue waiting to be submitted is invalid, then the current round of polling scheduling is completed. If the queue status of the waiting-to-submit queue is valid, then the commands in the waiting-to-submit queue will continue to be invoked.
6. The submission queue scheduling method according to claim 1, characterized in that, The method further includes: In a round of polling scheduling, monitor the storage status or response latency of the target completion queue; If the storage status is full or the response delay exceeds the threshold, then the command call processing of all submission queues corresponding to the target completion queue is suspended.
7. The submission queue scheduling method according to any one of claims 1-6, characterized in that, The step of executing the next round of polling scheduling if it is determined that the current round of polling scheduling has been completed includes: If the current round of polling scheduling is completed, the binding between all submission queues in the submission queue set and the call success identifier is removed, and the next round of polling scheduling is executed.
8. A submission queue scheduling device, characterized in that, The submission queue scheduling device includes: The binding module is used to bind a call success flag to the target submission queue when a command in the target submission queue in the submission queue set is called and the call result is placed into the corresponding completion queue during a round of polling scheduling. The judgment module is used to traverse the call success identifier binding status of each submission queue in the submission queue set and determine whether the current round of polling scheduling has been completed. The determination module is used to execute the next round of polling scheduling if it is determined that the current round of polling scheduling has been completed.
9. A solid-state drive, characterized in that, The solid-state drive includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the submission queue scheduling method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a processor, executes the submission queue scheduling method according to any one of claims 1-7.