diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-02 16:30:55 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-02 16:30:55 +1100 |
commit | 430cbeb86fdcbbdabea7d4aa65307de8de425350 (patch) | |
tree | 5d9e6851942ca74e0e13f9195b9c3f81c3bd7509 /fs/xfs/xfs_trans.h | |
parent | ff57ab21995a8636cfc72efeebb09cc6034d756f (diff) | |
download | blackbird-op-linux-430cbeb86fdcbbdabea7d4aa65307de8de425350.tar.gz blackbird-op-linux-430cbeb86fdcbbdabea7d4aa65307de8de425350.zip |
xfs: add a lru to the XFS buffer cache
Introduce a per-buftarg LRU for memory reclaim to operate on. This
is the last piece we need to put in place so that we can fully
control the buffer lifecycle. This allows XFS to be responsibile for
maintaining the working set of buffers under memory pressure instead
of relying on the VM reclaim not to take pages we need out from
underneath us.
The implementation introduces a b_lru_ref counter into the buffer.
This is currently set to 1 whenever the buffer is referenced and so is used to
determine if the buffer should be added to the LRU or not when freed.
Effectively it allows lazy LRU initialisation of the buffer so we do not need
to touch the LRU list and locks in xfs_buf_find().
Instead, when the buffer is being released and we drop the last
reference to it, we check the b_lru_ref count and if it is none zero
we re-add the buffer reference and add the inode to the LRU. The
b_lru_ref counter is decremented by the shrinker, and whenever the
shrinker comes across a buffer with a zero b_lru_ref counter, if
released the LRU reference on the buffer. In the absence of a lookup
race, this will result in the buffer being freed.
This counting mechanism is used instead of a reference flag so that
it is simple to re-introduce buffer-type specific reclaim reference
counts to prioritise reclaim more effectively. We still have all
those hooks in the XFS code, so this will provide the infrastructure
to re-implement that functionality.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_trans.h')
0 files changed, 0 insertions, 0 deletions