summaryrefslogtreecommitdiffstats
path: root/source3/lib/pthreadpool
Commit message (Collapse)AuthorAgeFilesLines
* pthreadpool: Slightly serialize jobsVolker Lendecke2014-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | Using the new msg_source program with 1.500 instances against a single msg_sink I found the msg_source process to spawn two worker threads for synchronously sending the data towards the receiving socket. This should not happen: Per destination node we only create one queue. We strictly only add pthreadpool jobs one after the other, so a single helper thread should be perfectly sufficient. It turned out that under heavy overload the main sending thread was scheduled before the thread that just had finished its send() job. So the helper thread was not able to increment the pool->num_idle variable indicating that we don't have to create a new thread when the new job is added. This patch moves the signalling write under the mutex. This means that indicating readiness via the pipe and the pool->num_idle variable happen both under the same mutex lock and thus are atomic. No superfluous threads anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pthreadpool: Allow multiple jobs to be receivedVolker Lendecke2014-03-274-27/+39
| | | | | | | This can avoid syscalls when multiple jobs are finished simultaneously Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pthreadpool: Avoid a malloc/free per jobVolker Lendecke2014-03-271-54/+91
| | | | | | | | | | | pthreadpool_add_job is in our hottest code path for r/w intensive workloads, so we should avoid anything CPU-intensive. pthreadpool used to malloc each job and free it in the worker thread. This patch adds a FIFO queue for jobs that helper threads copy from, avoiding constant malloc/free. This cuts user space CPU in the local-bench-pthreadpool benchmark by roughly 10% on my system. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pthreadpool: Add test for fork crashVolker Lendecke2014-03-031-0/+48
| | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Simo Sorce <simo@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pthreadpool: Fix pthreadpools with forkVolker Lendecke2014-03-031-15/+6
| | | | | | | | | | | | The current could would crash if a pthreadpool was created, deleted and the process then fork()s. "pthreadpools" is NULL in this case, but the pthread_atfork handlers are in place. This fixes walking the pthreadpools list in reverse. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Simo Sorce <simo@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* pthreadpool: Fix a comment, "quit"->"shutdown"Volker Lendecke2014-01-281-2/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Tue Jan 28 19:06:40 CET 2014 on sn-devel-104
* pthreadpool: Fix CID 710828 Sizeof not portableVolker Lendecke2013-05-121-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* build: Do not install testing binariesAndrew Bartlett2012-11-221-1/+2
| | | | | | | | | | | | | These binaries are for developer or selftest use, and are not supported for installation onto the system. The autoconf build does not install these binaries, and so neither should the waf build. Andrew Bartlett Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 22 12:00:36 CET 2012 on sn-devel-104
* s3: Fix compilation of pthreadpool_sync.c on platforms without pthread.hVolker Lendecke2012-06-281-1/+0
| | | | | | | Signed-off-by: Bjoern Jacke <bj@sernet.de> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Thu Jun 28 16:43:13 CEST 2012 on sn-devel-104
* s3: Add a dummy implementation for the pthreadpool APIVolker Lendecke2012-06-192-4/+183
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Fix the pthreadpool build on OS/XVolker Lendecke2012-04-091-0/+1
| | | | | OS/X does not have clock_gettime, and without replace.h we do not get the replacement macro
* s3: Update waf build to include missed dependancy on Lion.Ira Cooper2012-03-151-1/+1
| | | | | Autobuild-User: Ira Cooper <ira@samba.org> Autobuild-Date: Thu Mar 15 07:34:43 CET 2012 on sn-devel-104
* s3: Fix a typoVolker Lendecke2012-01-191-1/+1
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Jan 19 13:43:07 CET 2012 on sn-devel-104
* Change the signature of pthreadpool_finished_job() to return 0Jeremy Allison2011-12-223-14/+18
| | | | | | | | | on success, errno on fail and return the jobid in a separate variable. I need this fix for my vfs_aio_pthread.c module. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Dec 22 12:12:33 CET 2011 on sn-devel-104
* replace: Add don't include unistd.h directly and add uid_wrapper.Andreas Schneider2011-10-271-1/+1
|
* build: Fix waf build on MacOS XAndrew Bartlett2011-09-231-1/+2
| | | | | | | | | | | The -framework CoreFoundation is required by the charset_macosxfs module The system/time.h header is required to access the replacement clock_gettime() Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Sep 23 10:58:02 CEST 2011 on sn-devel-104
* s3-waf: Fix pthreadpool build which needs librt now.Andreas Schneider2011-06-061-1/+1
| | | | | Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Mon Jun 6 23:31:09 CEST 2011 on sn-devel-104
* s3/pthreadpool: replace bad portable gettimeofday by clock_gettimeBjörn Jacke2011-06-061-4/+2
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Properly clean up in pthreadpool_init in case of failureVolker Lendecke2011-04-271-0/+6
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Apr 27 23:57:19 CEST 2011 on sn-devel-104
* s3-waf: add pthreadpool support.Günther Deschner2011-04-271-0/+11
| | | | | | | | | Volker, please check. Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Wed Apr 27 17:57:32 CEST 2011 on sn-devel-104
* s3: Allow unlimited parallelism in pthreadpoolVolker Lendecke2011-04-262-9/+31
|
* s3: pthreadpool_sig_fd->pthreadpool_signal_fdVolker Lendecke2011-04-253-6/+6
|
* s3: Tiny doc for pthreadpoolVolker Lendecke2011-04-251-7/+59
|
* s3: Many pthreadpool fixesVolker Lendecke2011-04-254-0/+1005
In particular, this makes it fork-safe