Commit 0f78ab98 authored by Jens Axboe's avatar Jens Axboe

Revert "Seperate read and write statistics of in_flight requests"

This reverts commit a9327cac.

Corrado Zoccolo <czoccolo@gmail.com> reports:

"with 2.6.32-rc1 I started getting the following strange output from
"iostat -kx 2":
Linux 2.6.31bisect (et2) 	04/10/2009 	_i686_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          10,70    0,00    3,16   15,75    0,00   70,38

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s
avgrq-sz avgqu-sz   await  svctm  %util
sda              18,22     0,00    0,67    0,01    14,77     0,02
43,94     0,01   10,53 39043915,03 2629219,87
sdb              60,89     9,68   50,79    3,04  1724,43    50,52
65,95     0,70   13,06 488437,47 2629219,87

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2,72    0,00    0,74    0,00    0,00   96,53

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s
avgrq-sz avgqu-sz   await  svctm  %util
sda               0,00     0,00    0,00    0,00     0,00     0,00
0,00     0,00    0,00   0,00 100,00
sdb               0,00     0,00    0,00    0,00     0,00     0,00
0,00     0,00    0,00   0,00 100,00

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           6,68    0,00    0,99    0,00    0,00   92,33

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s
avgrq-sz avgqu-sz   await  svctm  %util
sda               0,00     0,00    0,00    0,00     0,00     0,00
0,00     0,00    0,00   0,00 100,00
sdb               0,00     0,00    0,00    0,00     0,00     0,00
0,00     0,00    0,00   0,00 100,00

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4,40    0,00    0,73    1,47    0,00   93,40

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s
avgrq-sz avgqu-sz   await  svctm  %util
sda               0,00     0,00    0,00    0,00     0,00     0,00
0,00     0,00    0,00   0,00 100,00
sdb               0,00     4,00    0,00    3,00     0,00    28,00
18,67     0,06   19,50 333,33 100,00

Global values for service time and utilization are garbage. For
interval values, utilization is always 100%, and service time is
higher than normal.

I bisected it down to:
[a9327cac] Seperate read and write
statistics of in_flight requests
and verified that reverting just that commit indeed solves the issue
on 2.6.32-rc1."

So until this is debugged, revert the bad commit.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent e00c54c3
...@@ -70,7 +70,7 @@ static void drive_stat_acct(struct request *rq, int new_io) ...@@ -70,7 +70,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
part_stat_inc(cpu, part, merges[rw]); part_stat_inc(cpu, part, merges[rw]);
else { else {
part_round_stats(cpu, part); part_round_stats(cpu, part);
part_inc_in_flight(part, rw); part_inc_in_flight(part);
} }
part_stat_unlock(); part_stat_unlock();
...@@ -1032,7 +1032,7 @@ static void part_round_stats_single(int cpu, struct hd_struct *part, ...@@ -1032,7 +1032,7 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
if (part->in_flight) { if (part->in_flight) {
__part_stat_add(cpu, part, time_in_queue, __part_stat_add(cpu, part, time_in_queue,
part_in_flight(part) * (now - part->stamp)); part->in_flight * (now - part->stamp));
__part_stat_add(cpu, part, io_ticks, (now - part->stamp)); __part_stat_add(cpu, part, io_ticks, (now - part->stamp));
} }
part->stamp = now; part->stamp = now;
...@@ -1739,7 +1739,7 @@ static void blk_account_io_done(struct request *req) ...@@ -1739,7 +1739,7 @@ static void blk_account_io_done(struct request *req)
part_stat_inc(cpu, part, ios[rw]); part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, ticks[rw], duration); part_stat_add(cpu, part, ticks[rw], duration);
part_round_stats(cpu, part); part_round_stats(cpu, part);
part_dec_in_flight(part, rw); part_dec_in_flight(part);
part_stat_unlock(); part_stat_unlock();
} }
......
...@@ -351,7 +351,7 @@ static void blk_account_io_merge(struct request *req) ...@@ -351,7 +351,7 @@ static void blk_account_io_merge(struct request *req)
part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
part_round_stats(cpu, part); part_round_stats(cpu, part);
part_dec_in_flight(part, rq_data_dir(req)); part_dec_in_flight(part);
part_stat_unlock(); part_stat_unlock();
} }
......
...@@ -869,7 +869,6 @@ static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); ...@@ -869,7 +869,6 @@ static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL); static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL);
static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL);
static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
static struct device_attribute dev_attr_fail = static struct device_attribute dev_attr_fail =
__ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store);
...@@ -889,7 +888,6 @@ static struct attribute *disk_attrs[] = { ...@@ -889,7 +888,6 @@ static struct attribute *disk_attrs[] = {
&dev_attr_alignment_offset.attr, &dev_attr_alignment_offset.attr,
&dev_attr_capability.attr, &dev_attr_capability.attr,
&dev_attr_stat.attr, &dev_attr_stat.attr,
&dev_attr_inflight.attr,
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
&dev_attr_fail.attr, &dev_attr_fail.attr,
#endif #endif
...@@ -1055,7 +1053,7 @@ static int diskstats_show(struct seq_file *seqf, void *v) ...@@ -1055,7 +1053,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
part_stat_read(hd, merges[1]), part_stat_read(hd, merges[1]),
(unsigned long long)part_stat_read(hd, sectors[1]), (unsigned long long)part_stat_read(hd, sectors[1]),
jiffies_to_msecs(part_stat_read(hd, ticks[1])), jiffies_to_msecs(part_stat_read(hd, ticks[1])),
part_in_flight(hd), hd->in_flight,
jiffies_to_msecs(part_stat_read(hd, io_ticks)), jiffies_to_msecs(part_stat_read(hd, io_ticks)),
jiffies_to_msecs(part_stat_read(hd, time_in_queue)) jiffies_to_msecs(part_stat_read(hd, time_in_queue))
); );
......
...@@ -130,7 +130,7 @@ struct mapped_device { ...@@ -130,7 +130,7 @@ struct mapped_device {
/* /*
* A list of ios that arrived while we were suspended. * A list of ios that arrived while we were suspended.
*/ */
atomic_t pending[2]; atomic_t pending;
wait_queue_head_t wait; wait_queue_head_t wait;
struct work_struct work; struct work_struct work;
struct bio_list deferred; struct bio_list deferred;
...@@ -453,14 +453,13 @@ static void start_io_acct(struct dm_io *io) ...@@ -453,14 +453,13 @@ static void start_io_acct(struct dm_io *io)
{ {
struct mapped_device *md = io->md; struct mapped_device *md = io->md;
int cpu; int cpu;
int rw = bio_data_dir(io->bio);
io->start_time = jiffies; io->start_time = jiffies;
cpu = part_stat_lock(); cpu = part_stat_lock();
part_round_stats(cpu, &dm_disk(md)->part0); part_round_stats(cpu, &dm_disk(md)->part0);
part_stat_unlock(); part_stat_unlock();
dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]); dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
} }
static void end_io_acct(struct dm_io *io) static void end_io_acct(struct dm_io *io)
...@@ -480,9 +479,8 @@ static void end_io_acct(struct dm_io *io) ...@@ -480,9 +479,8 @@ static void end_io_acct(struct dm_io *io)
* After this is decremented the bio must not be touched if it is * After this is decremented the bio must not be touched if it is
* a barrier. * a barrier.
*/ */
dm_disk(md)->part0.in_flight[rw] = pending = dm_disk(md)->part0.in_flight = pending =
atomic_dec_return(&md->pending[rw]); atomic_dec_return(&md->pending);
pending += atomic_read(&md->pending[rw^0x1]);
/* nudge anyone waiting on suspend queue */ /* nudge anyone waiting on suspend queue */
if (!pending) if (!pending)
...@@ -1787,8 +1785,7 @@ static struct mapped_device *alloc_dev(int minor) ...@@ -1787,8 +1785,7 @@ static struct mapped_device *alloc_dev(int minor)
if (!md->disk) if (!md->disk)
goto bad_disk; goto bad_disk;
atomic_set(&md->pending[0], 0); atomic_set(&md->pending, 0);
atomic_set(&md->pending[1], 0);
init_waitqueue_head(&md->wait); init_waitqueue_head(&md->wait);
INIT_WORK(&md->work, dm_wq_work); INIT_WORK(&md->work, dm_wq_work);
init_waitqueue_head(&md->eventq); init_waitqueue_head(&md->eventq);
...@@ -2091,8 +2088,7 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible) ...@@ -2091,8 +2088,7 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
break; break;
} }
spin_unlock_irqrestore(q->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
} else if (!atomic_read(&md->pending[0]) && } else if (!atomic_read(&md->pending))
!atomic_read(&md->pending[1]))
break; break;
if (interruptible == TASK_INTERRUPTIBLE && if (interruptible == TASK_INTERRUPTIBLE &&
......
...@@ -248,19 +248,11 @@ ssize_t part_stat_show(struct device *dev, ...@@ -248,19 +248,11 @@ ssize_t part_stat_show(struct device *dev,
part_stat_read(p, merges[WRITE]), part_stat_read(p, merges[WRITE]),
(unsigned long long)part_stat_read(p, sectors[WRITE]), (unsigned long long)part_stat_read(p, sectors[WRITE]),
jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), jiffies_to_msecs(part_stat_read(p, ticks[WRITE])),
part_in_flight(p), p->in_flight,
jiffies_to_msecs(part_stat_read(p, io_ticks)), jiffies_to_msecs(part_stat_read(p, io_ticks)),
jiffies_to_msecs(part_stat_read(p, time_in_queue))); jiffies_to_msecs(part_stat_read(p, time_in_queue)));
} }
ssize_t part_inflight_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hd_struct *p = dev_to_part(dev);
return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]);
}
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
ssize_t part_fail_show(struct device *dev, ssize_t part_fail_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
...@@ -289,7 +281,6 @@ static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); ...@@ -289,7 +281,6 @@ static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL);
static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL);
static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
static struct device_attribute dev_attr_fail = static struct device_attribute dev_attr_fail =
__ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store);
...@@ -301,7 +292,6 @@ static struct attribute *part_attrs[] = { ...@@ -301,7 +292,6 @@ static struct attribute *part_attrs[] = {
&dev_attr_size.attr, &dev_attr_size.attr,
&dev_attr_alignment_offset.attr, &dev_attr_alignment_offset.attr,
&dev_attr_stat.attr, &dev_attr_stat.attr,
&dev_attr_inflight.attr,
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
&dev_attr_fail.attr, &dev_attr_fail.attr,
#endif #endif
......
...@@ -98,7 +98,7 @@ struct hd_struct { ...@@ -98,7 +98,7 @@ struct hd_struct {
int make_it_fail; int make_it_fail;
#endif #endif
unsigned long stamp; unsigned long stamp;
int in_flight[2]; int in_flight;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
struct disk_stats *dkstats; struct disk_stats *dkstats;
#else #else
...@@ -322,23 +322,18 @@ static inline void free_part_stats(struct hd_struct *part) ...@@ -322,23 +322,18 @@ static inline void free_part_stats(struct hd_struct *part)
#define part_stat_sub(cpu, gendiskp, field, subnd) \ #define part_stat_sub(cpu, gendiskp, field, subnd) \
part_stat_add(cpu, gendiskp, field, -subnd) part_stat_add(cpu, gendiskp, field, -subnd)
static inline void part_inc_in_flight(struct hd_struct *part, int rw) static inline void part_inc_in_flight(struct hd_struct *part)
{ {
part->in_flight[rw]++; part->in_flight++;
if (part->partno) if (part->partno)
part_to_disk(part)->part0.in_flight[rw]++; part_to_disk(part)->part0.in_flight++;
} }
static inline void part_dec_in_flight(struct hd_struct *part, int rw) static inline void part_dec_in_flight(struct hd_struct *part)
{ {
part->in_flight[rw]--; part->in_flight--;
if (part->partno) if (part->partno)
part_to_disk(part)->part0.in_flight[rw]--; part_to_disk(part)->part0.in_flight--;
}
static inline int part_in_flight(struct hd_struct *part)
{
return part->in_flight[0] + part->in_flight[1];
} }
/* block/blk-core.c */ /* block/blk-core.c */
...@@ -551,8 +546,6 @@ extern ssize_t part_size_show(struct device *dev, ...@@ -551,8 +546,6 @@ extern ssize_t part_size_show(struct device *dev,
struct device_attribute *attr, char *buf); struct device_attribute *attr, char *buf);
extern ssize_t part_stat_show(struct device *dev, extern ssize_t part_stat_show(struct device *dev,
struct device_attribute *attr, char *buf); struct device_attribute *attr, char *buf);
extern ssize_t part_inflight_show(struct device *dev,
struct device_attribute *attr, char *buf);
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
extern ssize_t part_fail_show(struct device *dev, extern ssize_t part_fail_show(struct device *dev,
struct device_attribute *attr, char *buf); struct device_attribute *attr, char *buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment