Discuss the replacement strategy interface in bdbuf

Xiang Cui medivhc at gmail.com
Mon Jun 25 09:08:18 UTC 2012


Hi

I want to change the replacement strategy in bdbuf. The strategy in
bdbuf now is LRU. The detail information can be seen in Block Device
Buffer Management[1]. The field rtems_chain_node link is used to link
the buffer onto a number of lists.  State with CACHED and MODIFIED
can be hit in upper layer. That means they are neither in LRU List or
in Modified List before change state.

Task swapout ceaselessly change the buffer state from MODIFIED to
TRANSFER then CACHED.

The main purpose of the replacement policy is to find the victim
buffer to replace. This purpose is now done by maintaining the LRU
list. When a buffer is Transfer done or Released, it will be add the
to the tail. When the cache miss, the buffer management will look for
the buffer from the head in LRU list to replace. If no suitable buffer
in LRU list, it will wait.

The design in bdbuf now works fine with LRU, but not friendly with
other algorithm like clock which use a reference bit to indicate
accessed. Another trouble here is when block size changed, the cached
buffer need be reallocated.

I want some guide about how the replacement strategy interface should
be in bdbuf.

[1]Block Device Buffer Management
http://www.rtems.org/onlinedocs/doxygen/cpukit/html/group__rtems__bdbuf.html



More information about the devel mailing list