rxrpc: Use IDR to allocate client conn IDs on a machine-wide basis
authorDavid Howells <dhowells@redhat.com>
Mon, 4 Apr 2016 13:00:37 +0000 (14:00 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 22 Jun 2016 08:10:02 +0000 (09:10 +0100)
commit4a3388c8033e4ea00f06a341d5ed4a20a7da89de
tree4f4059e4c2decc37a7a886a4a9232fd928170b22
parentb3f575043fcd2926616a794db3f22280740fea6d
rxrpc: Use IDR to allocate client conn IDs on a machine-wide basis

Use the IDR facility to allocate client connection IDs on a machine-wide
basis so that each client connection has a unique identifier.  When the
connection ID space wraps, we advance the epoch by 1, thereby effectively
having a 62-bit ID space.  The IDR facility is then used to look up client
connections during incoming packet routing instead of using an rbtree
rooted on the transport.

This change allows for the removal of the transport in the future and also
means that client connections can be looked up directly in the data-ready
handler by connection ID.

The ID management code is placed in a new file, conn-client.c, to which all
the client connection-specific code will eventually move.

Note that the IDR tree gets very expensive on memory if the connection IDs
are widely scattered throughout the number space, so we shall need to
retire connections that have, say, an ID more than four times the maximum
number of client conns away from the current allocation point to try and
keep the IDs concentrated.  We will also need to retire connections from an
old epoch.

Also note that, for the moment, a pointer to the transport has to be passed
through into the ID allocation function so that we can take a BH lock to
prevent a locking issue against in-BH lookup of client connections.  This
will go away later when RCU is used for server connections also.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/Makefile
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-internal.h
net/rxrpc/conn_client.c [new file with mode: 0644]
net/rxrpc/conn_object.c
net/rxrpc/transport.c
This page took 0.038844 seconds and 5 git commands to generate.