Lines Matching full:buffer

16      buffer don't want to share a lock.
25 (*) What is a circular buffer?
35 What is a circular buffer?
38 First of all, what is a circular buffer? A circular buffer is a buffer of
42 buffer.
45 the buffer.
47 Typically when the tail pointer is equal to the head pointer, the buffer is
48 empty; and the buffer is full when the head pointer is one less than the tail
53 indices should be wrapped to 0 when they reach the end of the buffer, thus
54 allowing an infinite amount of data to flow through the buffer.
59 buffer, provided that neither index overtakes the other. The implementer must
61 the buffer and be broken into two segments.
67 circular buffer would normally be a slow operation, requiring the use of a
68 modulus (divide) instruction. However, if the buffer is of a power-of-2 size,
78 (#) Measure the remaining capacity of a buffer::
82 This returns the amount of space left in the buffer[1] into which items
86 (#) Measure the maximum consecutive immediate space in a buffer::
90 This returns the amount of consecutive space left in the buffer[1] into
92 beginning of the buffer.
95 (#) Measure the occupancy of a buffer::
99 This returns the number of items currently occupying a buffer[2].
102 (#) Measure the non-wrapping occupancy of a buffer::
107 the buffer without having to wrap back to the beginning of the buffer.
115 but the consumer may still be depleting the buffer on another CPU and
123 producer may still be filling the buffer on another CPU and moving the
127 emptying the buffer.
140 (1) use a single lock to govern access to both ends of the buffer, thus
141 allowing the buffer to be filled and emptied at the same time; and
145 There are two sides to this: the producer that fills the buffer, and the
146 consumer that empties it. Only one thing should be filling a buffer at any one
147 time, and only one thing should be emptying a buffer at any one time, but the
158 unsigned long head = buffer->head;
160 unsigned long tail = READ_ONCE(buffer->tail);
162 if (CIRC_SPACE(head, tail, buffer->size) >= 1) {
163 /* insert one item into the buffer */
164 struct item *item = buffer[head];
168 smp_store_release(buffer->head,
169 (head + 1) & (buffer->size - 1));
200 unsigned long head = smp_load_acquire(buffer->head);
201 unsigned long tail = buffer->tail;
203 if (CIRC_CNT(head, tail, buffer->size) >= 1) {
205 /* extract one item from the buffer */
206 struct item *item = buffer[tail];
211 smp_store_release(buffer->tail,
212 (tail + 1) & (buffer->size - 1));