freebsd-nq/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
cache
concat
eli Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected when 2015-08-08 09:51:38 +00:00
gate
journal
label
linux_lvm
mirror
mountver
multipath
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
sched
shsec
stripe
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
virstor
zero
geom_aes.c
geom_bsd_enc.c
geom_bsd.c
geom_ccd.c
geom_ctl.c
geom_ctl.h
geom_dev.c Fix panic triggered by code like this: 2015-08-04 10:40:08 +00:00
geom_disk.c
geom_disk.h
geom_dump.c
geom_event.c
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
geom_map.c
geom_mbr_enc.c
geom_mbr.c
geom_pc98_enc.c
geom_pc98.c
geom_redboot.c
geom_slice.c
geom_slice.h
geom_subr.c
geom_sunlabel_enc.c
geom_sunlabel.c
geom_vfs.c
geom_vfs.h
geom_vol_ffs.c
geom.h
notes