]> bbs.cooldavid.org Git - net-next-2.6.git/commit
xfs: convert buffer cache hash to rbtree
authorDave Chinner <dchinner@redhat.com>
Fri, 24 Sep 2010 09:59:04 +0000 (19:59 +1000)
committerAlex Elder <aelder@sgi.com>
Mon, 18 Oct 2010 20:07:56 +0000 (15:07 -0500)
commit74f75a0cb7033918eb0fa4a50df25091ac75c16e
tree3885c0b357c760152d14df03ef88839fdbf5f964
parent69b491c214d7fd4d4df972ae5377be99ca3753db
xfs: convert buffer cache hash to rbtree

The buffer cache hash is showing typical hash scalability problems.
In large scale testing the number of cached items growing far larger
than the hash can efficiently handle. Hence we need to move to a
self-scaling cache indexing mechanism.

I have selected rbtrees for indexing becuse they can have O(log n)
search scalability, and insert and remove cost is not excessive,
even on large trees. Hence we should be able to cache large numbers
of buffers without incurring the excessive cache miss search
penalties that the hash is imposing on us.

To ensure we still have parallel access to the cache, we need
multiple trees. Rather than hashing the buffers by disk address to
select a tree, it seems more sensible to separate trees by typical
access patterns. Most operations use buffers from within a single AG
at a time, so rather than searching lots of different lists,
separate the buffer indexes out into per-AG rbtrees. This means that
searches during metadata operation have a much higher chance of
hitting cache resident nodes, and that updates of the tree are less
likely to disturb trees being accessed on other CPUs doing
independent operations.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_buf.h
fs/xfs/xfs_ag.h
fs/xfs/xfs_mount.c