Commit Graph

3071 Commits

Author SHA1 Message Date
Brian Behlendorf a0796cadf7 Merge branch 'fix-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-06-29 11:34:31 -07:00
Brian Behlendorf ed1d1a7957 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-29 11:28:37 -07:00
Brian Behlendorf 0efc05dd6f Merge branch 'fix-stack-ztest' into refs/top-bases/fix-branch 2010-06-29 11:28:36 -07:00
Brian Behlendorf 865478a113 Update dependency fix-pthreads changes to fix-stack-ztest
This was done becaese fix-stack-ztest was added to the stack
in series after fix-pthreads because fix-stack-ztest depends
on many of the pthreads changes.
2010-06-29 11:27:33 -07:00
Brian Behlendorf ef01098ef4 Reduce stack used by ztest
While ztest does run in user space we run it with the same stack
restrictions it would have in kernel space.  This ensures that any
stack related issues which would be hit in the kernel can be caught
and debugged in user space instead.

This patch is a first pass to limit the stack usage of every ztest
function to 1024 bytes.  Subsequent updates can further reduce this
2010-06-29 11:25:08 -07:00
Brian Behlendorf b0c8dc3c75 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-29 11:11:59 -07:00
Brian Behlendorf 46b2d46053 Merge branch 'fix-stack-traverse_visitbp' into refs/top-bases/fix-branch 2010-06-29 11:04:51 -07:00
Brian Behlendorf b936d9e25f Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-29 11:04:51 -07:00
Brian Behlendorf 983bc7237f New TopGit dependency: fix-stack-traverse_visitbp 2010-06-29 11:04:48 -07:00
Brian Behlendorf 34229a2f2a 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.
2010-06-29 11:04:26 -07:00
Brian Behlendorf ffeafc898e Merge branch 'fix-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-06-29 10:55:38 -07:00
Brian Behlendorf b873e71b0f Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-29 10:29:42 -07:00
Brian Behlendorf 9fd3ea941b Merge commit 'refs/top-bases/gcc-branch' into gcc-branch 2010-06-29 10:25:31 -07:00
Brian Behlendorf 192b36dcfd Merge branch 'gcc-uninit' into refs/top-bases/gcc-branch 2010-06-29 10:25:31 -07:00
Brian Behlendorf 9cdd80e387 Revert traverse_impl() changes
These changes are now taken care of by the fix-stack-traverse_impl
topic branch which not only solves the uninit problem but also
moves these locals off the stack and on to the heap.
2010-06-29 10:24:14 -07:00
Brian Behlendorf 96bd9f434d Merge branch 'fix-stack-traverse_impl' into refs/top-bases/fix-branch 2010-06-29 10:21:53 -07:00
Brian Behlendorf c3681c9f29 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-29 10:21:53 -07:00
Brian Behlendorf 607b455090 New TopGit dependency: fix-stack-traverse_impl 2010-06-29 10:21:50 -07:00
Brian Behlendorf 8e2de85a6d Reduce stack usage of traverse_impl()
Stack use reduced from 560 bytes to 128 bytes.
2010-06-29 10:21:21 -07:00
Brian Behlendorf d2585f5921 Merge branch 'fix-stack-vn_open' into refs/top-bases/fix-branch 2010-06-29 10:15:05 -07:00
Brian Behlendorf 0a03ec3bf5 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-29 10:15:05 -07:00
Brian Behlendorf 53324fbd1f New TopGit dependency: fix-stack-vn_open 2010-06-29 10:15:02 -07:00
Brian Behlendorf edbb93c11d Reduce stack usage by vn_open()
We should not put a 4k maxpathlen buffer on the stack, instead
locate it to the heap.  Even in user space we run ztest with 8K
2010-06-29 10:14:37 -07:00
Brian Behlendorf 78cb5e6f60 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-29 10:12:04 -07:00
Brian Behlendorf 51a936233f Merge branch 'fix-stack-dsl_dataset_destroy' into refs/top-bases/fix-branch 2010-06-29 10:12:03 -07:00
Brian Behlendorf aa90238713 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-29 10:12:03 -07:00
Brian Behlendorf eabeea3b7c New TopGit dependency: fix-stack-dsl_dataset_destroy 2010-06-29 10:12:00 -07:00
Brian Behlendorf 7334572416 Reduce stack usage by dsl_dataset_destroy()
Move dsl_dataset_t local variable from the stack to the heap.
This reduces the stack usage of this function from 2048 bytes
to 176 bytes for x84_64 arches.
2010-06-29 10:11:32 -07:00
Brian Behlendorf 6fe1e37a5e Additional pthread related fixes for ztest
There are 3 fixes in thie commit.  First, update ztest_run() to store
the thread id and not the address of the kthread_t.  This will be freed
on thread exit and is not safe to use.  This is pretty close to how
things were done in the original ztest code before I got there.

Second, for extra paranoia update thread_exit() to return a special
TS_MAGIC value via pthread_exit().  This value is then verified in
pthread_join() to ensure the thread exited cleanly.  This can be
done cleanly because the kthread doesn't provide a return code
mechanism we need to worry about.

Third, replace the ztest deadman thread with a signal handler.  We
cannot use the previous approach because the correct behavior for
pthreads is to wait for all threads to exit before terminating the
process.  Since the deadman thread won't call exit by design we
end up hanging in kernel_exit().  To avoid this we just setup a
SIGALRM signal handle and register a deadman alarm.  IMHO this
is simpler and cleaner anyway.
2010-06-29 10:06:09 -07:00
Brian Behlendorf 17a1689bd4 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-28 11:30:35 -07:00
Brian Behlendorf 9a29d55b2f Merge commit 'refs/top-bases/gcc-branch' into gcc-branch 2010-06-28 11:30:34 -07:00
Brian Behlendorf c2793dd0c7 Merge branch 'gcc-missing-braces' into refs/top-bases/gcc-branch 2010-06-28 11:30:34 -07:00
Brian Behlendorf 5b02d6c084 Zero struct for zdb dump_block_stats
Accidentally dropped the zeroing of this structure in the
gcc-missing-braces topic branch which was causing a fall positive
space leak in ztest.  Ensure the structure is zero'ed before use.
2010-06-28 10:48:24 -07:00
Brian Behlendorf 191d5e833a Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-28 10:36:19 -07:00
Brian Behlendorf e8eea67f41 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-28 10:36:18 -07:00
Brian Behlendorf 8ec85f8aee Merge branch 'fix-stack-dmu_objset_snapshot' into refs/top-bases/fix-branch 2010-06-28 10:36:17 -07:00
Brian Behlendorf ee53c67258 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-28 10:36:17 -07:00
Brian Behlendorf 1a967e146f Merge branch 'fix-taskq' into refs/top-bases/fix-branch 2010-06-28 10:36:16 -07:00
Brian Behlendorf df8d7829a8 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-28 10:36:13 -07:00
Brian Behlendorf af239500df Merge commit 'refs/top-bases/gcc-branch' into gcc-branch 2010-06-28 10:36:12 -07:00
Brian Behlendorf ef3ec1c9ed Merge branch 'gcc-uninit' into refs/top-bases/gcc-branch 2010-06-28 10:36:11 -07:00
Brian Behlendorf 52bb0d8e75 Ensure zio_bad_cksum_t is initialized
This may not strictly be needed but it does keep gcc happy.  We
should keep our eye on this though if the extra bcopy significantly
impacts performance.  It may.
2010-06-28 10:30:38 -07:00
Brian Behlendorf a2e73b7516 Allow joinable threads
There was previous discussion of a race with joinable threads but to
be honest I can neither exactly remember the race, or recrease the
issue.  I believe it may have had to do with pthread_create() returning
without having set kt->tid since this was done in the created thread.
If that was the race then I've 'fixed' it by ensuring the thread id
is set in the thread AND as the first pthread_create() argument.  Why
this wasn't done originally I'm not sure, with luck Ricardo remembers.

Additionally, explicitly set a PAGESIZE guard frame at the end of the
stack to aid in detecting stack overflow.  And add some conditional
logic to set STACK_SIZE correctly for Solaris.
2010-06-28 10:15:29 -07:00
Brian Behlendorf 6914386b85 Never sleep under taskq_dispatch()
There are cases where under Linux it is not safe to sleep in
taskq_dispatch().  Rather than adding Linux specific code to
detect these cases I opted to keep it simple and just never
allow a sleep here.  The impact of this should be minimal.
2010-06-28 10:11:12 -07:00
Brian Behlendorf 0c11631b02 Fix for fix-stack-dmu_objset_snapshot should be 'sn' not '&sn'
I missed a instanse of removing the & operator when reducing the
stack usage in this function.  This unfortunately doesn't cause
a compile warning but it is does cause ztest failures.  Anyway,
update the topic branch to correct this mistake.
2010-06-28 10:06:29 -07:00
Brian Behlendorf 8de2671680 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-16 14:43:17 -07:00
Brian Behlendorf a0c72bab76 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-16 14:39:41 -07:00
Brian Behlendorf 6504afae4a Merge branch 'fix-stack-dmu_objset_snapshot' into refs/top-bases/fix-branch 2010-06-16 14:39:41 -07:00
Brian Behlendorf bf02bcb6ee New TopGit dependency: fix-stack-dmu_objset_snapshot 2010-06-16 14:39:39 -07:00
Brian Behlendorf e163b08ba3 Add fix-stack-dmu_objset_snapshot topic branch
Reduce stack usage by 276 bytes by moving the snaparg struct from the
stack to the heap.  We have limited stack space we must not waste.
2010-06-16 14:39:06 -07:00