IO scheduler, queue depth, nr_requests
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · linux.kernelNick Piggin
But the whole reason it is getting blocked in the first place is because your controller is sucking up all your requests. The whole problem is not a problem if you use properly sized queues.
I'm a bit surprised that it wasn't working well with a controller queue depth of 64 and 128
nr_requests. I'll give you a per process request limit patch to try in a minute.
And there's the rub... he did try what you are calling correctly sized queues, and his patch works better. I'm all in favor of having the theory and then writing the code, but when something works I would rather understand why and modify the theory.
In other words, given a patch which does help performance in this case, it would be good to understand why, instead of favoring a solution which is better in theory, but which has been tried and found inferior in performance.
I am NOT saying we should just block, effective as Miquel's patch seems, just that we should understand why it works well instead of saying it is in theory bad. I agree, but it works! Hopefully per-process limits solve this, but they "in theory" could result in blocking a process in an otherwise idle system. Unless I midread what you mean of course. Processes which calculate for a while and write results are not uncomon, and letting such a process write a whole bunch of data and then go calculate while it is written is certainly the way it should work. I'm unconvinced that per-process limits are the whole answer without considering the entire io load on the system.
Feel free to tell me I'm misreading your intent (and why).
Signature · 1 line
bill on the road <[email protected]>
In article <[email protected]>,
Quoted 7 lines · Bill Davidsen
Quoted 5 lines · linux.kernelNick Piggin
But the whole reason it is getting blocked in the first place is because your controller is sucking up all your requests. The whole problem is not a problem if you use properly sized queues.
Quoted 8 lines
Quoted 3 lines
I'm a bit surprised that it wasn't working well with a controller queue depth of 64 and 128
nr_requests. I'll give you a per process request limit patch to try in a minute.And there's the rub... he did try what you are calling correctly sized queues, and his patch works better. I'm all in favor of having the theory and then writing the code, but when something works I would rather understand why and modify the theory.
Ah, but we now do understand why - it was pdflush and a process fighting over get_request on basically the same device, before and after LVM remapping.
See:
http://www.ussg.iu.edu/hypermail/linux/kernel/0402.2/1522.html
More complete solutions:
https://www.redhat.com/archives/linux-lvm/2004-February/msg00203.html
https://www.redhat.com/archives/linux-lvm/2004-February/msg00215.html
Mike.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
[linux-lvm] PATCH: bdi_congested-core.patch (was: Re: IO scheduler, queue depth, nr_requests)
According to Jens Axboe:
Quoted 11 lines · Andrew Morton
Quoted 6 lines
Quoted 3 lines · Miquel van Smoorenburg
Well, I'm looking for guidance from Jens first, since I'm not sure if he wants the first solution (congestion testing passed down), the second (congestion setting passed up) or both.
The first patch looks nice. Why do we need the "pass it up" feature?
Miquel, the newer patches do tend to get too complicated. I suppose I'm fine with the first patch as well, modulo the dm part (I'd suggest merging it without and talking to Joe about doing it properly).
Okay here you go. I added bdi_rw_congested() for code in xfs and ext2 that calls both bdi_read_congested() and bdi_write_congested() in a row, and it was "free" anyway.
bdi_congested-core.patch
include/linux/backing-dev.h +19 -2
@@ -20,10 +20,14 @@ enum bdi_state { BDI_unused, /* Available bits start here */ }; +typedef int (congested_fn )(void *,int ); +struct backing_dev_info {unsigned long ra_pages;/* max readahead in PAGE_CACHE_SIZE units */ unsigned long state;/* Always use atomic bitops on this */ int memory_backed;/* Cannot clean pages with writepage */ +congested_fn *congested_fn;/* Function pointer if device is md/dm */ +void *congested_data;/* Pointer to aux data for congested func */ };extern struct backing_dev_info default_backing_dev_info;
@@ -32,14 +36,27 @@ int writeback_acquire(struct backing_devint writeback_in_progress (struct backing_dev_info *bdi);void writeback_release (struct backing_dev_info *bdi); +static inline int bdi_congested (struct backing_dev_info *bdi,int bdi_bits) +{ +if (bdi->congested_fn) +return bdi->congested_fn (bdi->congested_data, bdi_bits); +return (bdi->state & bdi_bits); +} +static inline int bdi_read_congested (struct backing_dev_info *bdi) { -return test_bit (BDI_read_congested, &bdi->state); +return bdi_congested (bdi,1 << BDI_read_congested); }static inline int bdi_write_congested (struct backing_dev_info *bdi) { -return test_bit (BDI_write_congested, &bdi->state); +return bdi_congested (bdi,1 << BDI_write_congested); +} + +static inline int bdi_rw_congested (struct backing_dev_info *bdi) +{ +return bdi_congested (bdi, (1 << BDI_read_congested)| + (1 << BDI_write_congested)); }#endif /* _LINUX_BACKING_DEV_H */
[linux-lvm] PATCH: bdi_congested-dm.patch (was: Re: IO scheduler, queue depth, nr_requests)
According to Miquel van Smoorenburg:
Quoted 2 lines
Okay here you go.
bdi_congested-core.patch
Here's the dm part:
bdi_congested-dm.patch
drivers/md/dm.h +1 -0
@@ -115,6 +115,7 @@ struct list_head *dm_table_get_devices(sint dm_table_get_mode (struct dm_table *t);void dm_table_suspend_targets (struct dm_table *t);void dm_table_resume_targets (struct dm_table *t); +int dm_table_any_congested (struct dm_table *t,int bdi_bits);/*----------------------------------------------------------------- * A registry of target types.
drivers/md/dm-table.c +14 -0
@@ -857,6 +857,20 @@ void dm_table_resume_targets(struct dm_t } } +int dm_table_any_congested (struct dm_table *t,int bdi_bits) +{ +struct list_head *d, *devices; +int r =0 ; + + devices =dm_table_get_devices (t); +for (d = devices->next; d != devices; d = d->next) { + struct dm_dev *dd = list_entry(d, struct dm_dev, list); +request_queue_t *q =bdev_get_queue (dd->bdev); + r |=bdi_congested (&q->backing_dev_info, bdi_bits); + } + +return r; +}EXPORT_SYMBOL (dm_get_device);EXPORT_SYMBOL (dm_put_device);
drivers/md/dm.c +14 -0
@@ -526,6 +526,18 @@ static int dm_request(request_queue_t *qreturn 0 ; } +static int dm_any_congested (void *congested_data,int bdi_bits) +{ +int r; +struct mapped_device *md = congested_data; + +down_read (&md->lock); + r =dm_table_any_congested (md->map, bdi_bits); +up_read (&md->lock); + +return r; +} +/*----------------------------------------------------------------- * A bitset is used to keep track of allocated minor numbers. *---------------------------------------------------------------*/
@@ -608,6 +620,8 @@ static struct mapped_device *alloc_dev(u } md->queue->queuedata = md; + md->queue->backing_dev_info.congested_fn = dm_any_congested; + md->queue->backing_dev_info.congested_data = md;blk_queue_make_request (md->queue, dm_request); md->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab,
[linux-lvm] Re: PATCH: bdi_congested-dm.patch (was: Re: IO scheduler, queue depth, nr_requests)
Quoted 7 lines · Miquel van Smoorenburg
According to Miquel van Smoorenburg:
Quoted 2 lines
Okay here you go.
bdi_congested-core.patchHere's the dm part:
bdi_congested-dm.patch
Looks good to me.
- Joe
[linux-lvm] Re: PATCH: bdi_congested-dm.patch (was: Re: IO scheduler, queue depth, nr_requests)
In reply to Miquel van Smoorenburgdrivers/md/dm.c static int dm_request(request_queue_t *q · line 536
Quoted 4 lines · Miquel van Smoorenburg
drivers/md/dm.c +3
-0+down_read (&md->lock); + r =dm_table_any_congested (md->map, bdi_bits); +up_read (&md->lock);
This can deadlock if anyone ever performs a __GFP_IO memory allocation while holding md->lock.
We could enter page reclaim with the lock held, come back in here and take it again. That's an instant deadlock if we were holding it for write and a super-rare deadlock if we were holding it for read (requires some other process to come in and run down_write() in between the two down_read()s).
A quick audit shows that we're OK, I think. What does dm_table_suspend_targets() do? But still, this restriction needs to be understood, documented and adhered to in future DM development.
If it gets really sticky in here it would be acceptable to do down_read_trylock() and return 0 if it fails - the congestion code is only advisory and 99% is good enough.
I like these patches btw - I was always worried about what the stacked-device impementation of queue congestion would look like, and this is nice and simple.
Quoted 12 lines · Bill Davidsen
Quoted 8 lines · linux.kernelNick Piggin
But the whole reason it is getting blocked in the first place is because your controller is sucking up all your requests. The whole problem is not a problem if you use properly sized queues.
I'm a bit surprised that it wasn't working well with a controller queue depth of 64 and 128
nr_requests. I'll give you a per process request limit patch to try in a minute.
Quoted 7 lines
And there's the rub... he did try what you are calling correctly sized queues, and his patch works better. I'm all in favor of having the theory and then writing the code, but when something works I would rather understand why and modify the theory.
In other words, given a patch which does help performance in this case, it would be good to understand why, instead of favoring a solution which is better in theory, but which has been tried and found inferior in performance.
I am NOT saying we should just block, effective as Miquel's patch seems, just that we should understand why it works well instead of saying it is in theory bad. I agree, but it works! Hopefully per-process limits solve this, but they "in theory" could result in blocking a process in an otherwise idle system. Unless I midread what you mean of course. Processes which calculate for a while and write results are not uncomon, and letting such a process write a whole bunch of data and then go calculate while it is written is certainly the way it should work. I'm unconvinced that per-process limits are the whole answer without considering the entire io load on the system.
Feel free to tell me I'm misreading your intent (and why).
No, I know Miquel's patch works and his analysis of what is happening is correct (he proved it). The patch is a bit of a hack to get around the specific problem he is seeing which should never happen with an appropriately sized queue, and it might actually hurt in some cases.