Skip to contentSkip to conversation

Question about CFQ queue preemption with REQ_PRIO

DISCUSSION Daeho Jeong 1 participant 1 message Mar 29, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

First of all, I am a big fan of the CFQ I/O scheduler. Thank you for your contribution. :-) I have a question about the below CFQ queue preemption condition in cfq_should_preempt().

        /*
         * So both queues are sync. Let the new request get disk time if
         * it's a metadata request and the current queue is doing regular IO.
         */
        if ((rq->cmd_flags & REQ_PRIO) && !cfqq->prio_pending)
                return true;

Normally, REQ_PRIO flag is used for READ requests for reading metadata, so then, the CFQ queue containing "rq" must be a SYNC queue and cfqq is also a SYNC queue because we already passed through the below condition. Therefore, the comment "So both queues are sync" is TRUE.

        if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
                return true;

But, I am wordering about the case of that an asynchronous WRITE request with REQ_PRIO is inserted into the request queue. Actually, ext4 metadata are submitted as asynchronous WRITE requests with REQ_PRIO by kworker. In this case, asynchronous WRITE requests can preempt synchronous READ requests. Anyways, I think ext4 metadata write should have priority for better filesystem call responsiveness, but the comment in the source code, "So both queues are sync", makes me a little confused.

Could you explain about the meaning of the comment in the source code?

Best Regards,