linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Carl Henrik Lunde <chlunde@ping.uio.no>
Cc: linux-kernel@vger.kernel.org
Subject: Re: CFQ: Preemption/timeout logic reversed?
Date: Mon, 20 Apr 2009 10:24:07 +0200	[thread overview]
Message-ID: <20090420082407.GV4593@kernel.dk> (raw)
In-Reply-To: <ed038eb20904192348m7f9f630q395baf123c3fd2ba@mail.gmail.com>

On Mon, Apr 20 2009, Carl Henrik Lunde wrote:
> On Mon, Apr 20, 2009 at 08:16, Jens Axboe <jens.axboe@oracle.com> wrote:
> > On Mon, Apr 20 2009, Carl Henrik Lunde wrote:
> >> Hi!
> >>
> >> It seems the preemption "bonus" logic in CFQ is reversed, a preempted
> >> process is given an additional delay in start time instead of a bonus.
> >>  This seems unfair.  I'm not sure if it's a good idea to let
> >
> > Hmm? ->slice_resid is a long, so if we preempt the process 10 jiffies
> > before it was supposed to end, the resid will be -10. So it'll not
> > increase the rb_key, it'll decrease it.
> 
> OK, so maybe I'm tired (I am!), but I don't get it. :)
> 
> {
>         if (... busy_rt_queues)
>                cfq_slice_expire(timed_out=1)
> }
> 
> cfq_slice_expire() {
> {
>         if (timed_out)
>                 slice_resid = slice_end - jiffies;
> }
> 
> if preempted it would be 100 - 90 = +10?

Hrmpf, that is buggy, it should be jiffies - slice_end! Presumably that
has been buggy since the shift to rb service tree, since (IIRC) that was
when it was changed from "add to slice length" to "adjust in tree".

-- 
Jens Axboe


      reply	other threads:[~2009-04-20  8:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20  0:56 CFQ: Preemption/timeout logic reversed? Carl Henrik Lunde
2009-04-20  6:16 ` Jens Axboe
2009-04-20  6:48   ` Carl Henrik Lunde
2009-04-20  8:24     ` Jens Axboe [this message]

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=20090420082407.GV4593@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=chlunde@ping.uio.no \
    --cc=linux-kernel@vger.kernel.org \
    /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).