Skip to content

What is the algorithm of buffer select in the buffer ring? #1022

Answered by axboe
arajni3 asked this question in Q&A
Discussion options

You must be logged in to vote

It'll just pick the first one. It's a very hot path, so no fancy selections are happening here. In general, regardless of whether this is ring provided buffers or the legacy ones, it'll be FIFO ordering. For ring provided buffers, that's the only way it can be done, and for legacy provided buffers, we just add to the tail when new buffers are provided.

If buffers are added dynamically, then won't this invalidate data in already used buffers?

Hmm? If the buffer is provided, it must be free to be used. When it's consumed, it's no longer in the pool, and has to be provided back. The application should not do that before it's finished with the data, obviously.

Or does it loop downwards unt…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arajni3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants