Commit Graph

1451 Commits

Author SHA1 Message Date
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 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 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 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
Brian Behlendorf a2ba5b83f8 Merge branch 'fix-stack-noinline' into refs/top-bases/fix-branch 2010-06-16 14:35:14 -07:00
Brian Behlendorf 94a22f54e5 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-16 14:35:14 -07:00
Brian Behlendorf 23d291df44 New TopGit dependency: fix-stack-noinline 2010-06-16 14:35:11 -07:00
Brian Behlendorf bbdb8184ec Add fix-stack-noinline topic branch
Certain function must never be automatically inlined by gcc because
they are stack heavy or called recursively.  This patch flags all
such functions I have found as 'noinline' to prevent gcc from making
the optimization.
2010-06-16 14:34:41 -07:00
Brian Behlendorf d297febad2 Remove fix-stack dependency from fix-branch 2010-06-16 14:30:40 -07:00
Brian Behlendorf 30c03a0914 Merge branch 'fix-stack' into refs/top-bases/fix-branch 2010-06-16 14:27:29 -07:00
Brian Behlendorf 1388d58932 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-16 14:27:29 -07:00
Brian Behlendorf 2115c30515 Revert fix-stack topic branch
This patch will be broken in to several independent stack reductions
and reapplied as new topic branches.
2010-06-16 14:23:31 -07:00
Brian Behlendorf 4c62777dcc Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-16 13:49:56 -07:00
Brian Behlendorf 256505afb0 Merge branch 'fix-stack-dsl_deleg_get' into refs/top-bases/fix-branch 2010-06-16 13:49:55 -07:00
Brian Behlendorf 2709f5731b New TopGit dependency: fix-stack-dsl_deleg_get 2010-06-16 13:49:53 -07:00
Brian Behlendorf 869764f64d Add fix-stack-dsl_deleg_get topic branch
Reduce stack usage in dsl_deleg_get, gcc flagged it as consuming a
whopping 1040 bytes or potentially 1/4 of a 4K stack.  This patch
moves all the large structures and buffer off the stack and on to
the heap.  This includes 2 zap_cursor_t structs each 52 bytes in
size, 2 zap_attribute_t structs each 280 bytes in size, and 1
256 byte char array.  The total saves on the stack is 880 bytes
after you account for the 5 new pointers added.

Also the source buffer length has been increased from MAXNAMELEN
to MAXNAMELEN+strlen(MOS_DIR_NAME)+1 as described by the comment in
dsl_dir_name().  A buffer overrun may have been possible with the
slightly smaller buffer.
2010-06-16 13:49:25 -07:00
Brian Behlendorf 912d828f0a Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-16 12:40:40 -07:00
Brian Behlendorf 31cc6992c5 Merge branch 'fix-stack-dsl_dir_open_spa' into refs/top-bases/fix-branch 2010-06-16 12:40:39 -07:00
Brian Behlendorf a2cbedd9e8 New TopGit dependency: fix-stack-dsl_dir_open_spa 2010-06-16 12:40:37 -07:00
Brian Behlendorf 0c524122bd Add fix-stack-dsl_dir_open_spa topic branch
Reduce stack usage by 256 bytes by moving buf char array from
the stack to the heap.
2010-06-16 12:39:44 -07:00
Brian Behlendorf 2f30cc0188 Merge branch 'fix-stack-lzjb' into refs/top-bases/fix-branch 2010-06-14 16:45:33 -07:00
Brian Behlendorf 1121733c6a Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-14 16:45:33 -07:00
Brian Behlendorf 4327d5dce3 New TopGit dependency: fix-stack-lzjb 2010-06-14 16:45:31 -07:00
Brian Behlendorf b8cc785fb6 Add fix-stack-lzjb topic branch
Reduce kernel stack usage by lzjb_compress() by moving uint16 array
off the stack and on to the heap.  The exact performance implications
of this I have not measured but we absolutely need to keep stack
usage to a minimum.  If/when this becomes and issue we optimize.
2010-06-14 16:45:01 -07:00
Brian Behlendorf 2392c05ea7 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-14 16:43:33 -07:00
Brian Behlendorf 51322821f3 Merge branch 'fix-kstat-xuio' into refs/top-bases/fix-branch 2010-06-14 16:43:32 -07:00
Brian Behlendorf f70976285e New TopGit dependency: fix-kstat-xuio 2010-06-14 16:43:30 -07:00
Brian Behlendorf f61a7ce9e1 Add fix-kstat-xuio topic branch
Move xiou stat structures from a header to the dmu.c source as is
done with all the other kstat interfaces.  This information is local
to dmu.c registered the xuio kstat and should stay that way.
2010-06-14 16:43:01 -07:00
Brian Behlendorf 963518b20f Merge branch 'fix-metaslab' into refs/top-bases/fix-branch 2010-06-14 16:40:45 -07:00
Brian Behlendorf 105afa78b4 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-14 16:40:45 -07:00
Brian Behlendorf 9519cc9a54 New TopGit dependency: fix-metaslab 2010-06-14 16:40:43 -07:00
Brian Behlendorf f3a61f709d Add fix-metaslab topic branch
If your only going to allow one allocator to be used and it is defined
at compile time there is no point including the others in the build.
This patch could/should be refined for Linux to make the metaslab
configurable at run time.  That might be a bit tricky however since
you would need to quiese all IO.  Short of that making it configurable
as a module load option would be a reasonable compromise.
2010-06-14 16:40:26 -07:00
Brian Behlendorf f3f44cbd31 Merge branch 'fix-current' into refs/top-bases/fix-branch 2010-06-14 16:39:27 -07:00
Brian Behlendorf 5b9ebcb897 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-14 16:39:27 -07:00
Brian Behlendorf 7a73e51832 New TopGit dependency: fix-current 2010-06-14 16:39:25 -07:00
Brian Behlendorf 6cf7f7c9df Add fix-current topic branch
In the linux kernel 'current' is defined to mean the current process
and can never be used as a local variable in a function.  Simply
replace all usage of 'current' with 'curr' in this function.
2010-06-14 16:38:56 -07:00
Brian Behlendorf 2969945552 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-14 16:22:00 -07:00
Brian Behlendorf a02204a8b5 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2010-06-14 16:22:00 -07:00
Brian Behlendorf bce1904fbb Merge branch 'fix-taskq' into refs/top-bases/fix-branch 2010-06-14 16:21:59 -07:00
Brian Behlendorf 6574b7cad4 New TopGit dependency: fix-pthreads 2010-06-14 16:21:57 -07:00