LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Why does the Linux block layer limit the number of requests(tags) that can be dispatched to driver? (https://www.linuxquestions.org/questions/linux-kernel-70/why-does-the-linux-block-layer-limit-the-number-of-requests-tags-that-can-be-dispatched-to-driver-4175730059/)

plznobug 10-20-2023 04:22 AM

Why does the Linux block layer limit the number of requests(tags) that can be dispatched to driver?
 
I have been studying the Linux kernel's block layer recently and have several questions that I can't figure out.

Currently, I know that upper layer IO enters the Linux block layer through submit_bio, which then calls make_request to obtain a request and puts it into a software queue (ctx->list or scheduler queue). Then, the queue_rq function is called to issue the request to the driver. This raises the following questions:

(1) If the scheduler is not enabled, the request is put into ctx->list before calling queue_rq to issue it to the driver. Why not directly call queue_rq to issue the request to the driver? It seems that putting the request into ctx->list has no meaning.

(2) If the scheduler is enabled, the request entering the scheduler queue needs to obtain a sched_tag, and if it fails to obtain one, the process will be blocked. Why is there a need to limit the number of requests entering the scheduler queue?

(3) When issuing to the driver, a driver tag needs to be obtained, and if it fails to obtain one, it will be blocked. Similarly, why is there a need to limit the number of requests entering the driver?

For (2) and (3), if unable to obtain tags, they will be blocked. So why not directly let them be issued to the driver since they will be asynchronous and wait for the requests to complete anyway? I don't understand the significance of limiting the quantity.


All times are GMT -5. The time now is 01:05 AM.