Discuss the replacement strategy interface in bdbuf

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 26 08:31:48 UTC 2012

On 06/25/2012 11:08 AM, Xiang Cui wrote:
> 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.

The list membership depends on the state and is documented in the table here:


> Task swapout ceaselessly change the buffer state from MODIFIED to
> 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.

Which data structures do you need to implement the other algorithms?  It would 
be nice if you can elaborate this a bit for the interested mailing list readers.

Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the devel mailing list