linux-IllusionX/net
Nick Piggin b3e19d924b fs: scale mntget/mntput
The problem that this patch aims to fix is vfsmount refcounting scalability.
We need to take a reference on the vfsmount for every successful path lookup,
which often go to the same mount point.

The fundamental difficulty is that a "simple" reference count can never be made
scalable, because any time a reference is dropped, we must check whether that
was the last reference. To do that requires communication with all other CPUs
that may have taken a reference count.

We can make refcounts more scalable in a couple of ways, involving keeping
distributed counters, and checking for the global-zero condition less
frequently.

- check the global sum once every interval (this will delay zero detection
  for some interval, so it's probably a showstopper for vfsmounts).

- keep a local count and only taking the global sum when local reaches 0 (this
  is difficult for vfsmounts, because we can't hold preempt off for the life of
  a reference, so a counter would need to be per-thread or tied strongly to a
  particular CPU which requires more locking).

- keep a local difference of increments and decrements, which allows us to sum
  the total difference and hence find the refcount when summing all CPUs. Then,
  keep a single integer "long" refcount for slow and long lasting references,
  and only take the global sum of local counters when the long refcount is 0.

This last scheme is what I implemented here. Attached mounts and process root
and working directory references are "long" references, and everything else is
a short reference.

This allows scalable vfsmount references during path walking over mounted
subtrees and unattached (lazy umounted) mounts with processes still running
in them.

This results in one fewer atomic op in the fastpath: mntget is now just a
per-CPU inc, rather than an atomic inc; and mntput just requires a spinlock
and non-atomic decrement in the common case. However code is otherwise bigger
and heavier, so single threaded performance is basically a wash.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
2011-01-07 17:50:33 +11:00
..
9p
802
8021q
appletalk
atm atm: correct sysfs 'device' link creation and parent relationships 2010-12-10 15:45:05 -08:00
ax25
bluetooth Bluetooth: Fix initial RFCOMM DLC security level 2010-12-06 15:47:44 -02:00
bridge bridge: stp: ensure mac header is set 2011-01-03 12:09:33 -08:00
caif
can CAN: Use inode instead of kernel address for /proc file 2010-12-31 11:13:27 -08:00
ceph Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2010-12-20 21:32:20 -08:00
core Revert "ipv4: Allow configuring subnets as local addresses" 2010-12-23 12:03:57 -08:00
dcb
dccp
decnet
dns_resolver
dsa
econet econet: Fix crash in aun_incoming(). 2010-12-08 20:51:15 -08:00
ethernet
ieee802154
ipv4 ipv4/route.c: respect prefsrc for local routes 2011-01-04 11:35:12 -08:00
ipv6 ipv6: Fragment locally generated tunnel-mode IPSec6 packets as needed. 2010-12-19 20:22:23 -08:00
ipx
irda Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-12-26 12:06:56 -08:00
iucv
key
l2tp l2tp: Fix modalias of l2tp_ip 2010-12-08 12:13:43 -08:00
lapb
llc llc: fix a device refcount imbalance 2010-12-08 09:58:44 -08:00
mac80211 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-12-26 12:06:56 -08:00
netfilter
netlabel
netlink
netrom
packet
phonet
rds
rfkill
rose
rxrpc
sched net_sched: sch_sfq: fix allot handling 2010-12-20 13:18:16 -08:00
sctp sctp: fix the return value of getting the sctp partial delivery point 2010-12-16 14:48:44 -08:00
sunrpc fs: dcache reduce branches in lookup path 2011-01-07 17:50:28 +11:00
tipc
unix
wanrouter
wimax
wireless
x25 x25: decrement netdev reference counts on unload 2010-12-08 12:13:44 -08:00
xfrm xfrm: Fix xfrm_state_migrate leak 2010-12-09 20:35:27 -08:00
compat.c
Kconfig
Makefile
nonet.c
socket.c fs: scale mntget/mntput 2011-01-07 17:50:33 +11:00
sysctl_net.c
TUNABLE