* cfq: fix possible problem with jiffies wraparound
@ 2009-10-04 17:09 Corrado Zoccolo
2009-10-05 6:46 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Corrado Zoccolo @ 2009-10-04 17:09 UTC (permalink / raw)
To: Linux-Kernel, Jens Axboe, Jeff Moyer
The RR service tree is indexed by a key that is relative to current jiffies.
This can cause problems on jiffies wraparound.
The patch fixes it using time_before comparison, and changing
the add_front path to use a relative number, too.
Signed-off-by: Corrado Zoccolo <czoccolo@gmail.com>
---
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 576e92d..495b16d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -512,8 +512,11 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies;
rb_key += cfqq->slice_resid;
cfqq->slice_resid = 0;
- } else
- rb_key = 0;
+ } else {
+ rb_key = -HZ;
+ __cfqq = cfq_rb_first(&cfqd->service_tree);
+ rb_key += __cfqq ? __cfqq->rb_key : jiffies;
+ }
if (!RB_EMPTY_NODE(&cfqq->rb_node)) {
/*
@@ -547,7 +550,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
n = &(*p)->rb_left;
else if (cfq_class_idle(cfqq) > cfq_class_idle(__cfqq))
n = &(*p)->rb_right;
- else if (rb_key < __cfqq->rb_key)
+ else if (time_before(rb_key, __cfqq->rb_key))
n = &(*p)->rb_left;
else
n = &(*p)->rb_right;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: cfq: fix possible problem with jiffies wraparound
2009-10-04 17:09 cfq: fix possible problem with jiffies wraparound Corrado Zoccolo
@ 2009-10-05 6:46 ` Jens Axboe
2009-10-05 6:50 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2009-10-05 6:46 UTC (permalink / raw)
To: Corrado Zoccolo; +Cc: Linux-Kernel, Jeff Moyer
On Sun, Oct 04 2009, Corrado Zoccolo wrote:
> The RR service tree is indexed by a key that is relative to current jiffies.
> This can cause problems on jiffies wraparound.
>
> The patch fixes it using time_before comparison, and changing
> the add_front path to use a relative number, too.
Good spotting, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cfq: fix possible problem with jiffies wraparound
2009-10-05 6:46 ` Jens Axboe
@ 2009-10-05 6:50 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2009-10-05 6:50 UTC (permalink / raw)
To: Corrado Zoccolo; +Cc: Linux-Kernel, Jeff Moyer
On Mon, Oct 05 2009, Jens Axboe wrote:
> On Sun, Oct 04 2009, Corrado Zoccolo wrote:
> > The RR service tree is indexed by a key that is relative to current jiffies.
> > This can cause problems on jiffies wraparound.
> >
> > The patch fixes it using time_before comparison, and changing
> > the add_front path to use a relative number, too.
>
> Good spotting, applied.
Your mailer seems to screw up your patches, it's white space damaged
(tabs are spaces). I hand applied it, but you probably want to check
that out and get it fixed.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-05 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-04 17:09 cfq: fix possible problem with jiffies wraparound Corrado Zoccolo
2009-10-05 6:46 ` Jens Axboe
2009-10-05 6:50 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox