Skip to contentSkip to conversation

Consistent terminology for ring buffers

Ksummit-discuss David Howells 2 participants 2 messages Jun 14, 2019 – Jun 17, 2019

lore
Share & tools
lore
#0 lore raw

Hi,

Can we settle on consistent terminology for ring buffers with regard to what we call the producer index and the consumer index?

In linux/circ_buf.h and Documentation/core-api/circular-buffers.rst and various other places "head" is the index at which insertion occurs and "tail" is the index of the next object to be consumed.

However, we have other places, notably the new io_uring stuff, in which this is reversed...

Looking online, I think head-as-insertion is more common, but I can find references to head-as-consumption.

Should we settle on one of the following for internal kernel use, at least inside the core documentation (not much we can do about UAPI necessarily):

	PRODUCER	CONSUMER
	===============	===============
	head		tail
	tail		head
	in		out
	insert		remove
	produce		consume

To quote Russell: "head is where the food goes in, the tail is where the ..."

David

#1 lore raw
Quoted 3 lines · David Howells

Can we settle on consistent terminology for ring buffers with regard to what we call the producer index and the consumer index?

"And all the people said, Amen!" :-)

Quoted 3 lines

In linux/circ_buf.h and Documentation/core-api/circular-buffers.rst and various other places "head" is the index at which insertion occurs and "tail" is the index of the next object to be consumed.

Quoted 1 line · That's certainly my preference; as Rusty

To quote Russell: "head is where the food goes in, the tail is where the ..."

I was a bit confused by what you meant by this table?

Quoted 7 lines
	PRODUCER	CONSUMER
	===============	===============
	head		tail
	tail		head
	in		out
	insert		remove
	produce		consume

Also, could you please make a submission of this proposal to the kernel summit track here as well:

	http://bit.ly/lpc19-submit

That will help us deal with scheduling. Thanks!!

- Ted