freebsd-skq/sys/geom
Warner Losh 3f2e5b8584 After the introduction of direct dispatch, the pacing code in g_down()
broke in two ways. One, the pacing variable was accessed in multiple
threads in an unsafe way. Two, since large numbers of I/O could come
down from the buf layer at one time, large numbers of allocation
failures could happen all at once, resulting in a huge pace value that
would limit I/Os to 10 IOPS for minutes (or even hours) at a
time. While a real solution to these problems requires substantial
work (to go to a no-allocation after the first model, or to have some
way to wait for more memory with some kind of reserve for pager and
swapper requests), it is relatively easy to make this simplistic
pacing less pathological.

Move to using a volatile variable with loads and stores. While this is
a little racy, losing the race is safe: either you get memory and
proceed, or you don't and queue. Second, sleep for 1ms (or one tick, whichever
is larger) instead of 100ms. This removes the artificial 10 IOPS limit
while still easing up on new I/Os during memory shortages. Remove
tying the amount of time we do this to the number of failed requests
and do it only as long as we keep failing requests.

Finally, to avoid needless recursion when memory is tight (start ->
g_io_deliver() -> g_io_request() -> start -> ... until we use 1/2 the
stack), don't do direct dispatch while pacing. This should be a rare
event (not steady state) so the performance hit here is worth the
extra safety of not starving g_down() with directly dispatched I/O.

Differential Review: https://reviews.freebsd.org/D3546
2015-09-02 17:29:30 +00:00
..
bde Constify the AES code and propagate to consumers. This allows us to 2014-11-10 09:44:38 +00:00
cache Unsigned values can never be less than 0. 2014-08-07 21:56:37 +00:00
concat Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
eli Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when 2015-08-08 09:51:38 +00:00
gate CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
journal CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
label Fix off-by-one error in fstyp(8) and geom_label(4) that made them use 2015-06-18 21:55:55 +00:00
linux_lvm Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
mirror CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
mountver
multipath Remove sleeps from geom_up thread on device destruction. 2015-04-09 13:09:05 +00:00
nop
part Report the scheme and provider names in warning message about unaligned 2015-07-26 11:16:48 +00:00
raid Clean out some externally visible "more then" grammar 2015-08-11 03:12:09 +00:00
raid3 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
sched CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
shsec Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
stripe Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
uncompress Make some debug printf's into DPRINTF's to reduce noise on attach/detahh 2015-08-09 06:58:06 +00:00
uzip Make some debug printf's into DPRINTF's to reduce noise on attach/detach 2015-08-06 15:30:14 +00:00
vinum Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
virstor Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
zero
geom_aes.c
geom_bsd_enc.c
geom_bsd.c Remove old ioctl use and support, once and for all. 2015-01-06 05:28:37 +00:00
geom_ccd.c
geom_ctl.c Always free sbuf in gctl_free(). 2014-01-23 21:30:31 +00:00
geom_ctl.h
geom_dev.c Fix panic triggered by code like this: 2015-08-04 10:40:08 +00:00
geom_disk.c Revert somewhat hackish geom_disk optimization, committed as part of r256880, 2014-10-25 15:16:19 +00:00
geom_disk.h
geom_dump.c Report withered providers as such alike to GEOMs. 2015-03-26 11:19:24 +00:00
geom_event.c We have two functions from where a geom orphan method could be called: 2014-05-19 16:05:42 +00:00
geom_flashmap.c Create a RouterBoard platform and use it to create a flash map 2015-08-22 05:50:18 +00:00
geom_fox.c
geom_int.h
geom_io.c After the introduction of direct dispatch, the pacing code in g_down() 2015-09-02 17:29:30 +00:00
geom_kern.c Fix multiple incorrect SYSCTL arguments in the kernel: 2014-10-21 07:31:21 +00:00
geom_map.c Fix the label search routine in geom_map to not trip up on '\0' bytes. 2015-03-19 03:58:25 +00:00
geom_mbr_enc.c
geom_mbr.c
geom_pc98_enc.c
geom_pc98.c
geom_redboot.c
geom_slice.c Make sure we don't free memory that's already been freed by setting 2014-04-06 02:20:42 +00:00
geom_slice.h
geom_subr.c When searching for provider by name, prefer non-withered one. 2015-03-26 11:02:29 +00:00
geom_sunlabel_enc.c
geom_sunlabel.c
geom_vfs.c
geom_vfs.h
geom_vol_ffs.c
geom.h
notes