Don't expose svc_loss_reg / _unreg to userland as they're kernel-only
additions from r260229 and the SVCPOOL type doesn't exist in userland.

(cherry picked from commit 3244f6064b0b506d4480b81e64dea620363457e4)
Properly free resources in case of error.

CID:		1007032
Found with:	Coverity Prevent(tm)
MFC after:	2 weeks

(cherry picked from commit c006433c40c6a68da01db7ddd1402578183ff59c)
Introduce new per-thread lock to protect the list of requests.

This allows to slightly simplify svc_run_internal() code: if we processed
all the requests in a queue, then we know that new one will not appear.

MFC after:	2 weeks

(cherry picked from commit aa54e738fe2ad03844beb77d1e655206c829d0f3)
Remove st_idle variable, duplicating st_xprt.

MFC after:	2 weeks

(cherry picked from commit c73f36ad0d93d806a2c6cb1231ea07d1924ed08e)
Split RPC pool threads into number of smaller semi-isolated groups.

Old design with unified thread pool was good from the point of thread
utilization.  But single pool-wide mutex became huge congestion point
for systems with many CPUs.  To reduce the congestion create several
thread groups within a pool (one group for every 6 CPUs and 12 threads),
each group with own mutex.  Each connection during its registration is
assigned to one of the groups in round-robin fashion.  File affinify
code may still move requests between the groups, but otherwise groups
are self-contained.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 18c81a620b48a1fe1d86fe9f1ba4dc0fc06024aa)
Fix race in r267221.

MFC after:	2 weeks

(cherry picked from commit 9264ec94fea14775eae6ce1ea9f982fb3a25b81e)
Use atomics to modify numvnodes variable.

This allows to mostly avoid lock usage in getnewvnode_[drop_]reserve(),
that reduces number of global vnode_free_list_mtx mutex acquisitions
from 4 to 2 per NFS request on ZFS, improving SMP scalability.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 14c8389ad08e251819c8c35fcaa75e0519595437)
Remove extra branching from r267232.

MFC after:	2 weeks

(cherry picked from commit 6106e186e66f75454d6257dad160bddf21d99d2a)
Move root_mount_hold() functionality to separate mutex.

It has nothing to share with mutex protecting list of mounted file systems.

(cherry picked from commit 1be587d5055cd66a4a8f82edf3a84f9db6721f69)
Remove unneeded mountlist_mtx acquisition from sync_fsync().

All struct mount fields accessed by sync_fsync() are protected by MNT_MTX.

(cherry picked from commit 60cbac59442236d3d8d9a9d3475a8b1b7421ae33)
Implement simple direct-mapped cache for popular filesystem identifiers to
avoid congestion on global mountlist_mtx mutex in vfs_busyfs(), while
traversing through the list of mount points.

This change significantly improves NFS server scalability, since it had
to do this translation for every request, and the global lock becomes quite
congested.

This code is more optimized for relatively small number of mount points.
On systems with hundreds of active mount points this simple cache may have
many collisions.  But the original traversal code in that case should also
behave much worse, so we are not loosing much.

Reviewed by:	attilio
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 9e5655843e8a396b95fa03ef3c67bb34e39b0775)
Fix r267788 build on stable/9.

(cherry picked from commit d3da9599c13304ac419db25dfc76ad957939c1d9)