linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Philipp Gruber <philipp.gruber@flupps.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Need information on elevator_dispatch_fn
Date: Wed, 31 Oct 2007 11:58:43 +0100	[thread overview]
Message-ID: <20071031105842.GH5059@kernel.dk> (raw)
In-Reply-To: <20071031100025.GC16598@mega2000.de>

On Wed, Oct 31 2007, Philipp Gruber wrote:
> Hello everyone,
> 
> I'm just working on an I/O-scheduler that implements some QoS
> functionality.
> 
> Now I get some weird problems and need to know what triggers my
> elevator_dispatch_fn, and how the return value of it is handled.
> For now, I found that the dispatch function is called as long as there
> are requests in my queue, so probably as long as it returns 1. On the
> other hand, only every second dispatch call returns 1, the others 0, but
> still it's working. I couldn't find any documentation about that (but
> would like to write some, if I understood it). Could someone please
> explain me when and why exactly elevator_dispatch_fn is triggered?

elevator_dispatch_fn() is in charge of putting request on the dispatch
list. So it'll be called, if q->queue_head is empty to refill that. The
core is __elv_next_request(), which is called when a block driver wants
to queue more IO. The logic is essentially:

elv_next_request()
{
        while (1) {
                if (!list_empty(&q->queue_head))
                        return first rq of list
                if (!elevator_dispatch_fn())
                        return NULL;
        }
}

So if you queue_head is empty AND elevator_dispatch_fn returns 0, then
no request is given to the driver. IF elevator_dispatch_fn returns
non-zero, then it MUST have put request on the queue_head list.

-- 
Jens Axboe


  reply	other threads:[~2007-10-31 11:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31 10:00 Need information on elevator_dispatch_fn Philipp Gruber
2007-10-31 10:58 ` Jens Axboe [this message]
2007-10-31 11:36 ` Aaron Carroll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071031105842.GH5059@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.gruber@flupps.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).