<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pm24.git/include/linux/sunrpc, branch v3.19-rc7</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>https://git.kobert.dev/pm24.git/atom?h=v3.19-rc7</id>
<link rel='self' href='https://git.kobert.dev/pm24.git/atom?h=v3.19-rc7'/>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/'/>
<updated>2014-12-09T16:22:22Z</updated>
<entry>
<title>sunrpc: convert to lockless lookup of queued server threads</title>
<updated>2014-12-09T16:22:22Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-21T19:19:30Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b1691bc03d4eddb959234409167bef9be9e62d74'/>
<id>urn:sha1:b1691bc03d4eddb959234409167bef9be9e62d74</id>
<content type='text'>
Testing has shown that the pool-&gt;sp_lock can be a bottleneck on a busy
server. Every time data is received on a socket, the server must take
that lock in order to dequeue a thread from the sp_threads list.

Address this problem by eliminating the sp_threads list (which contains
threads that are currently idle) and replacing it with a RQ_BUSY flag in
svc_rqst. This allows us to walk the sp_all_threads list under the
rcu_read_lock and find a suitable thread for the xprt by doing a
test_and_set_bit.

Note that we do still have a potential atomicity problem however with
this approach.  We don't want svc_xprt_do_enqueue to set the
rqst-&gt;rq_xprt pointer unless a test_and_set_bit of RQ_BUSY returned
zero (which indicates that the thread was idle). But, by the time we
check that, the bit could be flipped by a waking thread.

To address this, we acquire a new per-rqst spinlock (rq_lock) and take
that before doing the test_and_set_bit. If that returns false, then we
can set rq_xprt and drop the spinlock. Then, when the thread wakes up,
it must set the bit under the same spinlock and can trust that if it was
already set then the rq_xprt is also properly set.

With this scheme, the case where we have an idle thread no longer needs
to take the highly contended pool-&gt;sp_lock at all, and that removes the
bottleneck.

That still leaves one issue: What of the case where we walk the whole
sp_all_threads list and don't find an idle thread? Because the search is
lockess, it's possible for the queueing to race with a thread that is
going to sleep. To address that, we queue the xprt and then search again.

If we find an idle thread at that point, we can't attach the xprt to it
directly since that might race with a different thread waking up and
finding it.  All we can do is wake the idle thread back up and let it
attempt to find the now-queued xprt.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Chris Worley &lt;chris.worley@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: fix potential races in pool_stats collection</title>
<updated>2014-12-09T16:22:22Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-21T19:19:29Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=403c7b44441d60aba7f8a134c31279ffa60ea769'/>
<id>urn:sha1:403c7b44441d60aba7f8a134c31279ffa60ea769</id>
<content type='text'>
In a later patch, we'll be removing some spinlocking around the socket
and thread queueing code in order to fix some contention problems. At
that point, the stats counters will no longer be protected by the
sp_lock.

Change the counters to atomic_long_t fields, except for the
"sockets_queued" counter which will still be manipulated under a
spinlock.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Chris Worley &lt;chris.worley@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: add a rcu_head to svc_rqst and use kfree_rcu to free it</title>
<updated>2014-12-09T16:22:22Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-21T19:19:28Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=812443865c5fc255363d4a684a62c086af1addca'/>
<id>urn:sha1:812443865c5fc255363d4a684a62c086af1addca</id>
<content type='text'>
...also make the manipulation of sp_all_threads list use RCU-friendly
functions.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Chris Worley &lt;chris.worley@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: convert sp_task_pending flag to use atomic bitops</title>
<updated>2014-12-09T16:22:21Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:20Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=4d5db3f536ae3886ac86877742e6f8ce69a5de06'/>
<id>urn:sha1:4d5db3f536ae3886ac86877742e6f8ce69a5de06</id>
<content type='text'>
In a later patch, we'll want to be able to handle this flag without
holding the sp_lock. Change this field to an unsigned long flags
field, and declare a new flag in it that can be managed with atomic
bitops.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_cachetype field to better optimize space</title>
<updated>2014-12-09T16:22:21Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:19Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=62978b3c619422d0ea17dbd39efdb2328295bcfb'/>
<id>urn:sha1:62978b3c619422d0ea17dbd39efdb2328295bcfb</id>
<content type='text'>
There are a couple of holes in the svc_rqst field on x86_64. Move the
rq_cachetype to a different location to eliminate both of them.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_splice_ok flag into rq_flags</title>
<updated>2014-12-09T16:22:21Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=779fb0f3af3089daa2e88cf8ef0ef0c5d2fecb40'/>
<id>urn:sha1:779fb0f3af3089daa2e88cf8ef0ef0c5d2fecb40</id>
<content type='text'>
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_dropme flag into rq_flags</title>
<updated>2014-12-09T16:22:20Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:17Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=78b65eb3fda95c6d131c4bbb0536e21f0bd7a7d4'/>
<id>urn:sha1:78b65eb3fda95c6d131c4bbb0536e21f0bd7a7d4</id>
<content type='text'>
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_usedeferral flag to rq_flags</title>
<updated>2014-12-09T16:22:20Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:16Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=30660e04b0d4bbbd15fd21098681f45a9f4080b9'/>
<id>urn:sha1:30660e04b0d4bbbd15fd21098681f45a9f4080b9</id>
<content type='text'>
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: move rq_local field to rq_flags</title>
<updated>2014-12-09T16:21:21Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:15Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=7501cc2bcf9a71cc1f19e38775c234815ee44578'/>
<id>urn:sha1:7501cc2bcf9a71cc1f19e38775c234815ee44578</id>
<content type='text'>
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>sunrpc: add a generic rq_flags field to svc_rqst and move rq_secure to it</title>
<updated>2014-12-09T16:21:20Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-11-19T12:51:14Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=4d152e2c9a6a3e3556ce5da7782a9e2836edbe0f'/>
<id>urn:sha1:4d152e2c9a6a3e3556ce5da7782a9e2836edbe0f</id>
<content type='text'>
In a later patch, we're going to need some atomic bit flags. Since that
field will need to be an unsigned long, we mitigate that space
consumption by migrating some other bitflags to the new field. Start
with the rq_secure flag.

Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
</feed>
