From: Nick Piggin <piggin@cyberone.com.au>
To: "Prakash K. Cheemplavam" <prakashpublic@gmx.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.9test9-mm1 and DAO ATAPI cd-burning corrupt
Date: Sat, 08 Nov 2003 00:03:19 +1100 [thread overview]
Message-ID: <3FAB9817.5020502@cyberone.com.au> (raw)
In-Reply-To: <3FAB95B9.3020601@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
Prakash K. Cheemplavam wrote:
>
> Yes, with this patch, it seems to be like in mm1 again, no more
> stuttering (or at least I can't notice it anymore, as since 2 daysI
> have an LCD), but also the bad stuttering at erase and burn start are
> gone again. So do you have an idea what causes the problem?
>
Getting there, thanks for testing. We'll take the others off the CC
list: the problem is not in Linus' tree. Please try this patch.
[-- Attachment #2: as-revert2.patch --]
[-- Type: text/plain, Size: 11285 bytes --]
linux-2.6-npiggin/drivers/block/as-iosched.c | 219 +++++++++------------------
1 files changed, 78 insertions(+), 141 deletions(-)
diff -puN drivers/block/as-iosched.c~as-revert2 drivers/block/as-iosched.c
--- linux-2.6/drivers/block/as-iosched.c~as-revert2 2003-11-07 23:59:20.000000000 +1100
+++ linux-2.6-npiggin/drivers/block/as-iosched.c 2003-11-08 00:00:25.000000000 +1100
@@ -70,7 +70,6 @@
/* Bits in as_io_context.state */
enum as_io_states {
AS_TASK_RUNNING=0, /* Process has not exitted */
- AS_TASK_IOSTARTED, /* Process has started some IO */
AS_TASK_IORUNNING, /* Process has completed some IO */
};
@@ -100,14 +99,6 @@ struct as_data {
sector_t last_sector[2]; /* last REQ_SYNC & REQ_ASYNC sectors */
struct list_head *dispatch; /* driver dispatch queue */
struct list_head *hash; /* request hash */
-
- unsigned long exit_prob; /* probability a task will exit while
- being waited on */
- unsigned long new_ttime_total; /* mean thinktime on new proc */
- unsigned long new_ttime_mean;
- u64 new_seek_total; /* mean seek on new proc */
- sector_t new_seek_mean;
-
unsigned long current_batch_expires;
unsigned long last_check_fifo[2];
int changed_batch; /* 1: waiting for old batch to end */
@@ -195,7 +186,6 @@ static void free_as_io_context(struct as
/* Called when the task exits */
static void exit_as_io_context(struct as_io_context *aic)
{
- WARN_ON(!test_bit(AS_TASK_RUNNING, &aic->state));
clear_bit(AS_TASK_RUNNING, &aic->state);
}
@@ -618,15 +608,8 @@ static void as_antic_timeout(unsigned lo
spin_lock_irqsave(q->queue_lock, flags);
if (ad->antic_status == ANTIC_WAIT_REQ
|| ad->antic_status == ANTIC_WAIT_NEXT) {
- struct as_io_context *aic = ad->io_context->aic;
-
ad->antic_status = ANTIC_FINISHED;
kblockd_schedule_work(&ad->antic_work);
-
- if (aic->ttime_samples == 0) {
- /* process anticipated on has exitted or timed out*/
- ad->exit_prob = (7*ad->exit_prob + 256)/8;
- }
}
spin_unlock_irqrestore(q->queue_lock, flags);
}
@@ -640,7 +623,7 @@ static int as_close_req(struct as_data *
unsigned long delay; /* milliseconds */
sector_t last = ad->last_sector[ad->batch_data_dir];
sector_t next = arq->request->sector;
- sector_t delta; /* acceptable close offset (in sectors) */
+ sector_t delta; /* acceptable close offset (in sectors) */
if (ad->antic_status == ANTIC_OFF || !ad->ioc_finished)
delay = 0;
@@ -657,7 +640,6 @@ static int as_close_req(struct as_data *
return (last - (delta>>1) <= next) && (next <= last + delta);
}
-static void as_update_thinktime(struct as_data *ad, struct as_io_context *aic, unsigned long ttime);
/*
* as_can_break_anticipation returns true if we have been anticipating this
* request.
@@ -675,27 +657,9 @@ static int as_can_break_anticipation(str
{
struct io_context *ioc;
struct as_io_context *aic;
- sector_t s;
-
- ioc = ad->io_context;
- BUG_ON(!ioc);
-
- if (arq && ioc == arq->io_context) {
- /* request from same process */
- return 1;
- }
if (arq && arq->is_sync == REQ_SYNC && as_close_req(ad, arq)) {
/* close request */
- struct as_io_context *aic = ioc->aic;
- if (aic) {
- unsigned long thinktime;
- spin_lock(&aic->lock);
- thinktime = jiffies - aic->last_end_request;
- aic->last_end_request = jiffies;
- as_update_thinktime(ad, aic, thinktime);
- spin_unlock(&aic->lock);
- }
return 1;
}
@@ -707,14 +671,20 @@ static int as_can_break_anticipation(str
return 1;
}
+ ioc = ad->io_context;
+ BUG_ON(!ioc);
+
+ if (arq && ioc == arq->io_context) {
+ /* request from same process */
+ return 1;
+ }
+
aic = ioc->aic;
if (!aic)
return 0;
if (!test_bit(AS_TASK_RUNNING, &aic->state)) {
/* process anticipated on has exitted */
- if (aic->ttime_samples == 0)
- ad->exit_prob = (7*ad->exit_prob + 256)/8;
return 1;
}
@@ -728,36 +698,27 @@ static int as_can_break_anticipation(str
return 1;
}
- if (aic->ttime_samples == 0) {
- if (ad->new_ttime_mean > ad->antic_expire)
- return 1;
- if (ad->exit_prob > 128)
- return 1;
- } else if (aic->ttime_mean > ad->antic_expire) {
- /* the process thinks too much between requests */
+ if (aic->seek_samples == 0 || aic->ttime_samples == 0) {
+ /*
+ * Process has just started IO. Don't anticipate.
+ * TODO! Must fix this up.
+ */
return 1;
}
- if (!arq)
- return 0;
-
- if (ad->last_sector[REQ_SYNC] < arq->request->sector)
- s = arq->request->sector - ad->last_sector[REQ_SYNC];
- else
- s = ad->last_sector[REQ_SYNC] - arq->request->sector;
+ if (aic->ttime_mean > ad->antic_expire) {
+ /* the process thinks too much between requests */
+ return 1;
+ }
- if (aic->seek_samples == 0) {
- /*
- * Process has just started IO. Use past statistics to
- * guage success possibility
- */
- if (ad->new_seek_mean/2 > s) {
- /* this request is better than what we're expecting */
- return 1;
- }
+ if (arq && aic->seek_samples) {
+ sector_t s;
+ if (ad->last_sector[REQ_SYNC] < arq->request->sector)
+ s = arq->request->sector - ad->last_sector[REQ_SYNC];
+ else
+ s = ad->last_sector[REQ_SYNC] - arq->request->sector;
- } else {
- if (aic->seek_mean/2 > s) {
+ if (aic->seek_mean > (s>>1)) {
/* this request is better than what we're expecting */
return 1;
}
@@ -802,51 +763,12 @@ static int as_can_anticipate(struct as_d
return 1;
}
-static void as_update_thinktime(struct as_data *ad, struct as_io_context *aic, unsigned long ttime)
-{
- /* fixed point: 1.0 == 1<<8 */
- if (aic->ttime_samples == 0) {
- ad->new_ttime_total = (7*ad->new_ttime_total + 256*ttime) / 8;
- ad->new_ttime_mean = ad->new_ttime_total / 256;
-
- ad->exit_prob = (7*ad->exit_prob)/8;
- }
- aic->ttime_samples = (7*aic->ttime_samples + 256) / 8;
- aic->ttime_total = (7*aic->ttime_total + 256*ttime) / 8;
- aic->ttime_mean = (aic->ttime_total + 128) / aic->ttime_samples;
-}
-
-static void as_update_seekdist(struct as_data *ad, struct as_io_context *aic, sector_t sdist)
-{
- u64 total;
-
- if (aic->seek_samples == 0) {
- ad->new_seek_total = (7*ad->new_seek_total + 256*(u64)sdist)/8;
- ad->new_seek_mean = ad->new_seek_total / 256;
- }
-
- /*
- * Don't allow the seek distance to get too large from the
- * odd fragment, pagein, etc
- */
- if (aic->seek_samples <= 60) /* second&third seek */
- sdist = min(sdist, (aic->seek_mean * 4) + 2*1024*1024);
- else
- sdist = min(sdist, (aic->seek_mean * 4) + 2*1024*64);
-
- aic->seek_samples = (7*aic->seek_samples + 256) / 8;
- aic->seek_total = (7*aic->seek_total + (u64)256*sdist) / 8;
- total = aic->seek_total + (aic->seek_samples/2);
- do_div(total, aic->seek_samples);
- aic->seek_mean = (sector_t)total;
-}
-
/*
* as_update_iohist keeps a decaying histogram of IO thinktimes, and
* updates @aic->ttime_mean based on that. It is called when a new
* request is queued.
*/
-static void as_update_iohist(struct as_data *ad, struct as_io_context *aic, struct request *rq)
+static void as_update_iohist(struct as_io_context *aic, struct request *rq)
{
struct as_rq *arq = RQ_DATA(rq);
int data_dir = arq->is_sync;
@@ -857,29 +779,60 @@ static void as_update_iohist(struct as_d
return;
if (data_dir == REQ_SYNC) {
- unsigned long in_flight = atomic_read(&aic->nr_queued)
- + atomic_read(&aic->nr_dispatched);
spin_lock(&aic->lock);
- if (test_bit(AS_TASK_IORUNNING, &aic->state) ||
- test_bit(AS_TASK_IOSTARTED, &aic->state)) {
+
+ if (test_bit(AS_TASK_IORUNNING, &aic->state)
+ && !atomic_read(&aic->nr_queued)
+ && !atomic_read(&aic->nr_dispatched)) {
/* Calculate read -> read thinktime */
- if (test_bit(AS_TASK_IORUNNING, &aic->state)
- && in_flight == 0) {
- thinktime = jiffies - aic->last_end_request;
- thinktime = min(thinktime, MAX_THINKTIME-1);
- } else
- thinktime = 0;
- as_update_thinktime(ad, aic, thinktime);
-
- /* Calculate read -> read seek distance */
- if (aic->last_request_pos < rq->sector)
- seek_dist = rq->sector - aic->last_request_pos;
- else
- seek_dist = aic->last_request_pos - rq->sector;
- as_update_seekdist(ad, aic, seek_dist);
- }
+ thinktime = jiffies - aic->last_end_request;
+ thinktime = min(thinktime, MAX_THINKTIME-1);
+ /* fixed point: 1.0 == 1<<8 */
+ aic->ttime_samples += 256;
+ aic->ttime_total += 256*thinktime;
+ if (aic->ttime_samples)
+ /* fixed point factor is cancelled here */
+ aic->ttime_mean = (aic->ttime_total + 128)
+ / aic->ttime_samples;
+ aic->ttime_samples = (aic->ttime_samples>>1)
+ + (aic->ttime_samples>>2);
+ aic->ttime_total = (aic->ttime_total>>1)
+ + (aic->ttime_total>>2);
+ }
+
+ /* Calculate read -> read seek distance */
+ if (!aic->seek_samples)
+ seek_dist = 0;
+ else if (aic->last_request_pos < rq->sector)
+ seek_dist = rq->sector - aic->last_request_pos;
+ else
+ seek_dist = aic->last_request_pos - rq->sector;
+
aic->last_request_pos = rq->sector + rq->nr_sectors;
- set_bit(AS_TASK_IOSTARTED, &aic->state);
+
+ /*
+ * Don't allow the seek distance to get too large from the
+ * odd fragment, pagein, etc
+ */
+ if (aic->seek_samples < 400) /* second&third seek */
+ seek_dist = min(seek_dist, (aic->seek_mean * 4)
+ + 2*1024*1024);
+ else
+ seek_dist = min(seek_dist, (aic->seek_mean * 4)
+ + 2*1024*64);
+
+ aic->seek_samples += 256;
+ aic->seek_total += (u64)256*seek_dist;
+ if (aic->seek_samples) {
+ u64 total = aic->seek_total + (aic->seek_samples>>1);
+ do_div(total, aic->seek_samples);
+ aic->seek_mean = (sector_t)total;
+ }
+ aic->seek_samples = (aic->seek_samples>>1)
+ + (aic->seek_samples>>2);
+ aic->seek_total = (aic->seek_total>>1)
+ + (aic->seek_total>>2);
+
spin_unlock(&aic->lock);
}
}
@@ -1426,8 +1379,8 @@ static void as_add_request(struct as_dat
arq->io_context = as_get_io_context();
if (arq->io_context) {
- as_update_iohist(ad, arq->io_context->aic, arq->request);
atomic_inc(&arq->io_context->aic->nr_queued);
+ as_update_iohist(arq->io_context->aic, arq->request);
}
alias = as_add_arq_rb(ad, arq);
@@ -1933,17 +1886,6 @@ as_var_store(unsigned long *var, const c
return count;
}
-static ssize_t as_est_show(struct as_data *ad, char *page)
-{
- int pos = 0;
-
- pos += sprintf(page+pos, "%lu %% exit probability\n", 100*ad->exit_prob/256);
- pos += sprintf(page+pos, "%lu ms new thinktime\n", ad->new_ttime_mean);
- pos += sprintf(page+pos, "%llu sectors new seek distance\n", (unsigned long long)ad->new_seek_mean);
-
- return pos;
-}
-
#define SHOW_FUNCTION(__FUNC, __VAR) \
static ssize_t __FUNC(struct as_data *ad, char *page) \
{ \
@@ -1975,10 +1917,6 @@ STORE_FUNCTION(as_write_batchexpire_stor
&ad->batch_expire[REQ_ASYNC], 0, INT_MAX);
#undef STORE_FUNCTION
-static struct as_fs_entry as_est_entry = {
- .attr = {.name = "est_time", .mode = S_IRUGO },
- .show = as_est_show,
-};
static struct as_fs_entry as_readexpire_entry = {
.attr = {.name = "read_expire", .mode = S_IRUGO | S_IWUSR },
.show = as_readexpire_show,
@@ -2006,7 +1944,6 @@ static struct as_fs_entry as_write_batch
};
static struct attribute *default_attrs[] = {
- &as_est_entry.attr,
&as_readexpire_entry.attr,
&as_writeexpire_entry.attr,
&as_anticexpire_entry.attr,
_
next prev parent reply other threads:[~2003-11-07 23:13 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-03 18:22 2.9test9-mm1 and DAO ATAPI cd-burning corrupt Prakash K. Cheemplavam
2003-11-05 8:40 ` Jens Axboe
2003-11-05 9:55 ` Prakash K. Cheemplavam
2003-11-05 9:54 ` Jens Axboe
2003-11-05 10:01 ` Prakash K. Cheemplavam
2003-11-05 10:01 ` Jens Axboe
2003-11-05 10:12 ` Prakash K. Cheemplavam
2003-11-05 10:12 ` Jens Axboe
2003-11-05 10:20 ` Prakash K. Cheemplavam
2003-11-05 10:22 ` Jens Axboe
2003-11-05 10:31 ` Prakash K. Cheemplavam
2003-11-05 12:39 ` Jens Axboe
2003-11-05 18:47 ` Prakash K. Cheemplavam
2003-11-06 9:17 ` Jens Axboe
2003-11-06 12:42 ` Prakash K. Cheemplavam
2003-11-06 12:59 ` Nick Piggin
2003-11-06 13:00 ` Jens Axboe
2003-11-06 13:05 ` Nick Piggin
2003-11-06 13:05 ` Jens Axboe
2003-11-06 13:11 ` Nick Piggin
2003-11-06 13:11 ` Jens Axboe
2003-11-06 13:31 ` Prakash K. Cheemplavam
2003-11-06 13:31 ` Jens Axboe
2003-11-06 13:44 ` Prakash K. Cheemplavam
2003-11-06 13:47 ` Jens Axboe
2003-11-06 13:54 ` Nick Piggin
2003-11-06 13:52 ` Jens Axboe
2003-11-10 21:45 ` bill davidsen
2003-11-06 14:00 ` Prakash K. Cheemplavam
2003-11-06 13:58 ` Prakash K. Cheemplavam
2003-11-06 13:51 ` Jens Axboe
2003-11-06 14:31 ` Prakash K. Cheemplavam
2003-11-06 17:42 ` Matthew Reppert
2003-11-06 18:48 ` Prakash K. Cheemplavam
2003-11-06 19:45 ` Maciej Zenczykowski
2003-11-06 14:38 ` Prakash K. Cheemplavam
2003-11-06 18:49 ` Martin Josefsson
2003-11-06 19:06 ` Prakash K. Cheemplavam
2003-11-06 20:07 ` Martin Josefsson
[not found] ` <3FAB0754.2040209@cyberone.com.au>
2003-11-07 11:18 ` Prakash K. Cheemplavam
2003-11-07 11:31 ` Nick Piggin
[not found] ` <3FAB8428.7090307@gmx.de>
[not found] ` <3FAB870D.1050003@cyberone.com.au>
2003-11-07 12:53 ` Prakash K. Cheemplavam
2003-11-07 13:03 ` Nick Piggin [this message]
[not found] ` <3FAB9C2B.2040907@gmx.de>
[not found] ` <3FAB9F97.6050706@cyberone.com.au>
[not found] ` <3FABA364.9000404@gmx.de>
[not found] ` <3FABA5A7.904@cyberone.com.au>
[not found] ` <3FABA6EF.90207@gmx.de>
[not found] ` <3FABA788.1080000@cyberone.com.au>
[not found] ` <3FABAB5B.5090105@gmx.de>
[not found] ` <3FABAE0B.6020601@cyberone.com.au>
[not found] ` <3FABB08B.3080006@gmx.de>
[not found] ` <3FABB571.6070804@cyberone.com.au>
2003-11-07 15:48 ` Prakash K. Cheemplavam
2003-11-08 2:14 ` Nick Piggin
2003-11-08 12:31 ` Prakash K. Cheemplavam
2003-11-08 21:17 ` Randy.Dunlap
2003-11-10 22:23 ` bill davidsen
2003-11-11 14:46 ` Zwane Mwaikambo
2003-11-11 15:31 ` bill davidsen
2003-11-10 22:26 ` bill davidsen
2003-11-10 21:25 ` bill davidsen
2003-11-06 19:14 ` bill davidsen
2003-11-06 19:45 ` Linus Torvalds
2003-11-07 9:13 ` Rob Landley
2003-11-07 14:21 ` Bill Davidsen
2003-11-07 23:25 ` Rob Landley
2003-11-08 2:39 ` Nick Piggin
2003-11-07 12:46 ` Jens Axboe
2003-11-06 19:55 ` Gene Heskett
2003-11-06 22:36 ` Bill Davidsen
2003-11-07 0:51 ` Gene Heskett
2003-11-10 22:14 ` bill davidsen
2003-11-05 10:26 ` Nick Piggin
2003-11-05 10:29 ` Jens Axboe
2003-11-05 10:36 ` Prakash K. Cheemplavam
2003-11-05 11:14 ` Nick Piggin
2003-11-05 12:38 ` Jens Axboe
2003-11-05 17:36 ` Prakash K. Cheemplavam
2003-11-05 18:43 ` Prakash K. Cheemplavam
2003-11-05 10:54 ` Gene Heskett
2003-11-05 11:26 ` Jens Axboe
2003-11-05 10:33 ` Prakash K. Cheemplavam
2003-11-06 19:08 ` bill davidsen
2003-11-06 19:35 ` Linus Torvalds
2003-11-06 19:56 ` John Bradford
2003-11-07 14:10 ` Bill Davidsen
2003-11-07 15:01 ` Linus Torvalds
2003-11-08 15:06 ` Ragnar Hojland Espinosa
2003-11-08 17:52 ` Linus Torvalds
2003-11-08 18:16 ` viro
2003-11-10 19:22 ` Bill Davidsen
2003-11-10 19:01 ` Bill Davidsen
2003-11-10 19:25 ` Linus Torvalds
2003-11-10 20:03 ` Bill Davidsen
2003-11-10 20:22 ` Linus Torvalds
2003-11-11 4:48 ` bill davidsen
2003-11-11 5:40 ` Linus Torvalds
2003-11-11 17:49 ` Diego Calleja García
2003-11-11 18:15 ` Diego Calleja García
2003-11-12 22:58 ` bill davidsen
2003-11-12 23:47 ` Bartlomiej Zolnierkiewicz
2003-11-13 7:06 ` Jens Axboe
2003-11-15 13:13 ` Bill Davidsen
2003-11-15 13:43 ` Jens Axboe
2003-11-17 13:23 ` Bill Davidsen
2003-11-06 21:10 ` Prakash K. Cheemplavam
2003-11-06 21:40 ` Prakash K. Cheemplavam
2003-11-07 21:05 ` Jens Axboe
2003-11-09 10:49 ` Prakash K. Cheemplavam
2003-11-10 22:06 ` bill davidsen
2003-11-07 9:46 ` Xavier Bestel
2003-11-07 8:24 ` Jens Axboe
2003-11-05 11:17 ` DervishD
[not found] ` <3FA8C8E5.10903@gmx.de>
[not found] ` <20031105095350.GF1477@suse.de>
2003-11-05 10:00 ` Prakash K. Cheemplavam
[not found] <OXZz.7Uj.3@gated-at.bofh.it>
[not found] ` <OY9D.86A.29@gated-at.bofh.it>
2003-11-06 21:22 ` Pascal Schmidt
[not found] <QyWV.2Zi.1@gated-at.bofh.it>
[not found] ` <QzzF.3WK.3@gated-at.bofh.it>
2003-11-11 16:43 ` Pascal Schmidt
2003-11-11 17:00 ` Linus Torvalds
[not found] <Pine.LNX.4.44.0311110950250.30657-100000@home.osdl.org>
2003-11-11 19:41 ` Pascal Schmidt
2003-11-11 22:50 ` Martin Schlemmer
2003-11-11 21:41 ` Pascal Schmidt
2003-11-11 22:04 ` Linus Torvalds
2003-11-11 23:46 ` Pascal Schmidt
2003-11-12 1:14 ` Linus Torvalds
2003-11-12 17:32 ` Pascal Schmidt
2003-11-12 18:20 ` Pascal Schmidt
2003-11-12 18:31 ` Jens Axboe
2003-11-12 19:44 ` Pascal Schmidt
2003-11-13 11:52 ` Bill Davidsen
2003-11-13 12:20 ` Jens Axboe
2003-11-13 13:19 ` Pascal Schmidt
2003-11-13 14:35 ` Jens Axboe
2003-11-13 15:22 ` Linus Torvalds
2003-11-13 15:27 ` Jens Axboe
2003-11-15 13:16 ` Bill Davidsen
2003-11-13 13:17 ` Pascal Schmidt
2003-11-15 13:04 ` Bill Davidsen
2003-11-12 0:04 ` Daniel Pittman
2003-11-12 0:09 ` Pascal Schmidt
[not found] <RoMa.Mi.7@gated-at.bofh.it>
[not found] ` <RpI1.2RG.5@gated-at.bofh.it>
[not found] ` <RqNS.54j.11@gated-at.bofh.it>
2003-11-13 15:05 ` Pascal Schmidt
2003-11-13 15:28 ` Jens Axboe
2003-11-13 15:32 ` Pascal Schmidt
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=3FAB9817.5020502@cyberone.com.au \
--to=piggin@cyberone.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=prakashpublic@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.