]> git.karo-electronics.de Git - karo-tx-linux.git/commit
We have already acknowledged that swapoff of a tmpfs file is slower than
authorHugh Dickins <hughd@google.com>
Wed, 3 Aug 2011 00:52:55 +0000 (10:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Aug 2011 02:50:42 +0000 (12:50 +1000)
commit5908d8cb6535d271d9a8362f011dd9e528cc3ae8
tree7205ca06bea1c19a6c3bab98fd521b7d48dca7c0
parentcfdcb260c6f3a80fa2881f3d135c5eddc300ab29
We have already acknowledged that swapoff of a tmpfs file is slower than
it was before conversion to the generic radix_tree: a little slower there
will be acceptable, if the hotter paths are faster.

But it was a shock to find swapoff of a 500MB file 20 times slower on my
laptop, taking 10 minutes; and at that rate it significantly slows down my
testing.

Now, most of that turned out to be overhead from PROVE_LOCKING and
PROVE_RCU: without those it was only 4 times slower than before; and more
realistic tests on other machines don't fare as badly.

I've tried a number of things to improve it, including tagging the swap
entries, then doing lookup by tag: I'd expected that to halve the time,
but in practice it's erratic, and often counter-productive.

The only change I've so far found to make a consistent improvement, is to
short-circuit the way we go back and forth, gang lookup packing entries
into the array supplied, then shmem scanning that array for the target
entry.  Scanning in place doubles the speed, so it's now only twice as
slow as before (or three times slower when the PROVEs are on).

So, add radix_tree_locate_item() as an expedient, once-off, single-caller
hack to do the lookup directly in place.  #ifdef it on CONFIG_SHMEM and
CONFIG_SWAP, as much to document its limited applicability as save space
in other configurations.  And, sadly, #include sched.h for cond_resched().

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/radix-tree.h
lib/radix-tree.c
mm/shmem.c