]> granicus.if.org Git - zfs/commit
Reduce stack usage for recursive traverse_visitbp()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Jun 2010 18:04:26 +0000 (11:04 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Jun 2010 18:04:26 +0000 (11:04 -0700)
commit34229a2f2ac07363f64ddd63e014964fff2f0671
tree783afead6dbee478600678cd3e9ec3e3855466bd
parent428870ff734fdaccc342b33fc53cf94724409a46
Reduce stack usage for recursive traverse_visitbp()

Due to  limited stack space recursive functions are frowned upon in
the Linux kernel.  However, they often are the most elegant solution
to a problem.  The following code preserves the recursive function
traverse_visitbp() but moves the local variables AND function
arguments to the heap to minimize the stack frame size.  Enough
space is initially allocated on the stack for 20 levels of recursion.
This change does ugly-up-the-code but it reduces the worst case
usage from roughly 4160 bytes to 960 bytes on x86_64 archs.
.topdeps [new file with mode: 0644]
.topmsg [new file with mode: 0644]
module/zfs/dmu_traverse.c