Ksummit-Discuss Archive on lore.kernel.org
 help / color / Atom feed
* [Ksummit-discuss] [TECH TOPIC] Consistent terminology for ring buffers
@ 2019-06-14 14:21 David Howells
  2019-06-17 13:45 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2019-06-14 14:21 UTC (permalink / raw)
  To: ksummit-discuss; +Cc: peterz, paulmck, linux

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Ksummit-discuss] [TECH TOPIC] Consistent terminology for ring buffers
  2019-06-14 14:21 [Ksummit-discuss] [TECH TOPIC] Consistent terminology for ring buffers David Howells
@ 2019-06-17 13:45 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-06-17 13:45 UTC (permalink / raw)
  To: David Howells; +Cc: peterz, paulmck, linux, ksummit-discuss

On Fri, Jun 14, 2019 at 03:21:19PM +0100, David Howells wrote:
> 
> 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!"  :-)

> 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.

That's certainly my preference; as Rusty said:

> 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?

> 	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
							

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 14:21 [Ksummit-discuss] [TECH TOPIC] Consistent terminology for ring buffers David Howells
2019-06-17 13:45 ` Theodore Ts'o

Ksummit-Discuss Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/ksummit-discuss/0 ksummit-discuss/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ksummit-discuss ksummit-discuss/ https://lore.kernel.org/ksummit-discuss \
		ksummit-discuss@lists.linuxfoundation.org
	public-inbox-index ksummit-discuss

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxfoundation.lists.ksummit-discuss


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git