<feed xmlns='http://www.w3.org/2005/Atom'>
<title>samba.git/source3/lib/pthreadpool, branch talloc-2.1.2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/'/>
<entry>
<title>pthreadpool: Slightly serialize jobs</title>
<updated>2014-08-22T22:24:18+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-08-21T19:55:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=1c4284c7395f23cefa61a407db74cf5067aee2aa'/>
<id>1c4284c7395f23cefa61a407db74cf5067aee2aa</id>
<content type='text'>
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-&gt;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-&gt;num_idle variable happen both
under the same mutex lock and thus are atomic. No superfluous threads anymore.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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-&gt;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-&gt;num_idle variable happen both
under the same mutex lock and thus are atomic. No superfluous threads anymore.

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Allow multiple jobs to be received</title>
<updated>2014-03-27T05:06:11+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-03-24T10:39:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=c5d07df6abe657ff196266bbfbb376ca7db0968b'/>
<id>c5d07df6abe657ff196266bbfbb376ca7db0968b</id>
<content type='text'>
This can avoid syscalls when multiple jobs are finished simultaneously

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This can avoid syscalls when multiple jobs are finished simultaneously

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Avoid a malloc/free per job</title>
<updated>2014-03-27T05:06:11+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-03-21T16:53:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=84aa2ddd861549d6ec8d1ef15f4fd518e03f449b'/>
<id>84aa2ddd861549d6ec8d1ef15f4fd518e03f449b</id>
<content type='text'>
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 &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;vl@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Add test for fork crash</title>
<updated>2014-03-03T13:31:33+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-03-03T11:57:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=7e12bfc6a8fe97da907525ae90288e37c4fa7a7f'/>
<id>7e12bfc6a8fe97da907525ae90288e37c4fa7a7f</id>
<content type='text'>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Kamen Mazdrashki &lt;kamenim@samba.org&gt;
Reviewed-by: Simo Sorce &lt;simo@samba.org&gt;
Reviewed-by: Michael Adam &lt;obnox@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Kamen Mazdrashki &lt;kamenim@samba.org&gt;
Reviewed-by: Simo Sorce &lt;simo@samba.org&gt;
Reviewed-by: Michael Adam &lt;obnox@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Fix pthreadpools with fork</title>
<updated>2014-03-03T13:29:24+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-03-03T11:20:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=ccc187ff5e6cbc411476c5f5e68cc6bb1fe35818'/>
<id>ccc187ff5e6cbc411476c5f5e68cc6bb1fe35818</id>
<content type='text'>
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 &lt;vl@samba.org&gt;
Reviewed-by: Kamen Mazdrashki &lt;kamenim@samba.org&gt;
Reviewed-by: Simo Sorce &lt;simo@samba.org&gt;
Reviewed-by: Michael Adam &lt;obnox@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;vl@samba.org&gt;
Reviewed-by: Kamen Mazdrashki &lt;kamenim@samba.org&gt;
Reviewed-by: Simo Sorce &lt;simo@samba.org&gt;
Reviewed-by: Michael Adam &lt;obnox@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Fix a comment, "quit"-&gt;"shutdown"</title>
<updated>2014-01-28T18:06:40+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2014-01-27T10:08:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=58865d96f187b843acea6d80f595ae9023f13708'/>
<id>58865d96f187b843acea6d80f595ae9023f13708</id>
<content type='text'>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: David Disseldorp &lt;ddiss@samba.org&gt;

Autobuild-User(master): David Disseldorp &lt;ddiss@samba.org&gt;
Autobuild-Date(master): Tue Jan 28 19:06:40 CET 2014 on sn-devel-104
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: David Disseldorp &lt;ddiss@samba.org&gt;

Autobuild-User(master): David Disseldorp &lt;ddiss@samba.org&gt;
Autobuild-Date(master): Tue Jan 28 19:06:40 CET 2014 on sn-devel-104
</pre>
</div>
</content>
</entry>
<entry>
<title>pthreadpool: Fix CID 710828 Sizeof not portable</title>
<updated>2013-05-12T13:56:32+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2013-05-12T10:44:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=7027c6aca96ce4eb4b6a4207f206d7b85eae7c56'/>
<id>7027c6aca96ce4eb4b6a4207f206d7b85eae7c56</id>
<content type='text'>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Ira Cooper &lt;ira@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Ira Cooper &lt;ira@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>build: Do not install testing binaries</title>
<updated>2012-11-22T11:00:36+00:00</updated>
<author>
<name>Andrew Bartlett</name>
<email>abartlet@samba.org</email>
</author>
<published>2012-11-21T09:20:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=f22e15d9d5a3d4744982265363c357ef277ba31e'/>
<id>f22e15d9d5a3d4744982265363c357ef277ba31e</id>
<content type='text'>
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 &lt;asn@samba.org&gt;

Autobuild-User(master): Andreas Schneider &lt;asn@cryptomilk.org&gt;
Autobuild-Date(master): Thu Nov 22 12:00:36 CET 2012 on sn-devel-104
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;asn@samba.org&gt;

Autobuild-User(master): Andreas Schneider &lt;asn@cryptomilk.org&gt;
Autobuild-Date(master): Thu Nov 22 12:00:36 CET 2012 on sn-devel-104
</pre>
</div>
</content>
</entry>
<entry>
<title>s3: Fix compilation of pthreadpool_sync.c on platforms without pthread.h</title>
<updated>2012-06-28T14:43:13+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2012-06-28T09:19:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=572701f9c84f70271d8ba7353c6638c0358bfbdd'/>
<id>572701f9c84f70271d8ba7353c6638c0358bfbdd</id>
<content type='text'>
Signed-off-by: Bjoern Jacke &lt;bj@sernet.de&gt;

Autobuild-User(master): Björn Jacke &lt;bj@sernet.de&gt;
Autobuild-Date(master): Thu Jun 28 16:43:13 CEST 2012 on sn-devel-104
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Bjoern Jacke &lt;bj@sernet.de&gt;

Autobuild-User(master): Björn Jacke &lt;bj@sernet.de&gt;
Autobuild-Date(master): Thu Jun 28 16:43:13 CEST 2012 on sn-devel-104
</pre>
</div>
</content>
</entry>
<entry>
<title>s3: Add a dummy implementation for the pthreadpool API</title>
<updated>2012-06-19T17:27:24+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2012-06-13T11:05:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=8b35a4de3880e1a3f64534db9748d5786a2ccb01'/>
<id>8b35a4de3880e1a3f64534db9748d5786a2ccb01</id>
<content type='text'>
Signed-off-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
