Peter Holm reports a low-mem buf_trie_alloc() failure:
panic: buf_vlist_add: Preallocated nodes insufficient. cpuid = 9 time = 1596433571 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0339908560 vpanic() at vpanic+0x182/frame 0xfffffe03399085b0 panic() at panic+0x43/frame 0xfffffe0339908610 buf_vlist_add() at buf_vlist_add+0x1c1/frame 0xfffffe0339908640 reassignbuf() at reassignbuf+0x15f/frame 0xfffffe0339908670 bdirty() at bdirty+0x58/frame 0xfffffe03399086b0 bdwrite() at bdwrite+0x92/frame 0xfffffe0339908720 ext2_update() at ext2_update+0x1c0/frame 0xfffffe0339908770 ext2_inactive() at ext2_inactive+0x3f/frame 0xfffffe03399087a0 VOP_INACTIVE_APV() at VOP_INACTIVE_APV+0x59/frame 0xfffffe03399087c0 vinactivef() at vinactivef+0x107/frame 0xfffffe0339908810 vput_final() at vput_final+0x298/frame 0xfffffe0339908870 kern_funlinkat() at kern_funlinkat+0x336/frame 0xfffffe0339908ab0 sys_unlink() at sys_unlink+0x28/frame 0xfffffe0339908ad0
The buf trie UMA zone is preallocated to contain all the entries we ever
need, so the failure of M_NOWAIT alloc is not expected. The problem seems
to be that SMR deferred-free latency causes preallocated zones to
unpredictably run out of free items. From Peter's report, the "free" count
is a majority of the total item count, so it seems like we would need to
preallocate an unacceptably greater number of items (like 2x) to avoid this
shortfall, and it does not seem robust anyway:
db:0:pho> show uma Zone Size Used Free Requests Sleeps Bucket Total Mem XFree BUF TRIE 144 4708 127172 102807141 0 62 18990720 0 ^^^^ ^^^^^^ 96% free
So what is the right way to reliably preallocate SMR zone items, such that
allocation does not need to sleep (or ideally, spin much)? buf_trie_alloc()
and similar SMR consumers could do the spin externally to UMA; I don't see
any obvious place inside UMA to spin, aside from right at the API boundary
(this patch). We could set a special flag on preallocated zones?
Any suggestions welcome.
Reported by: pho
X-MFC-With: r363482