<feed xmlns='http://www.w3.org/2005/Atom'>
<title>samba.git/source3/lib/pthreadpool/pthreadpool.c, 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: 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>s3: Fix the pthreadpool build on OS/X</title>
<updated>2012-04-09T16:05:02+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2012-04-09T07:17:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=8a907c9c6563d9b1df35d31390bd07f76758773c'/>
<id>8a907c9c6563d9b1df35d31390bd07f76758773c</id>
<content type='text'>
OS/X does not have clock_gettime, and without replace.h we do not
get the replacement macro
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
OS/X does not have clock_gettime, and without replace.h we do not
get the replacement macro
</pre>
</div>
</content>
</entry>
<entry>
<title>Change the signature of pthreadpool_finished_job() to return 0</title>
<updated>2011-12-22T11:12:33+00:00</updated>
<author>
<name>Jeremy Allison</name>
<email>jra@samba.org</email>
</author>
<published>2011-12-22T04:38:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=711c18c2301d1bea35cac1144080a94e6b89be27'/>
<id>711c18c2301d1bea35cac1144080a94e6b89be27</id>
<content type='text'>
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 &lt;jra@samba.org&gt;
Autobuild-Date: Thu Dec 22 12:12:33 CET 2011 on sn-devel-104
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;jra@samba.org&gt;
Autobuild-Date: Thu Dec 22 12:12:33 CET 2011 on sn-devel-104
</pre>
</div>
</content>
</entry>
<entry>
<title>replace: Add don't include unistd.h directly and add uid_wrapper.</title>
<updated>2011-10-27T11:32:02+00:00</updated>
<author>
<name>Andreas Schneider</name>
<email>asn@samba.org</email>
</author>
<published>2011-10-08T10:10:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=7b5fb7d9e88bf848173363f5a1e2a0f1db6c7293'/>
<id>7b5fb7d9e88bf848173363f5a1e2a0f1db6c7293</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>build: Fix waf build on MacOS X</title>
<updated>2011-09-23T08:58:02+00:00</updated>
<author>
<name>Andrew Bartlett</name>
<email>abartlet@samba.org</email>
</author>
<published>2011-09-21T01:19:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=2a789c8442ce730cac112eeb89c7eb497bb5cc15'/>
<id>2a789c8442ce730cac112eeb89c7eb497bb5cc15</id>
<content type='text'>
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 &lt;abartlet@samba.org&gt;
Autobuild-Date: Fri Sep 23 10:58:02 CEST 2011 on sn-devel-104
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;abartlet@samba.org&gt;
Autobuild-Date: Fri Sep 23 10:58:02 CEST 2011 on sn-devel-104
</pre>
</div>
</content>
</entry>
</feed>
