• Home
  • Raw
  • Download

Lines Matching +full:back +full:- +full:end

12  (1) Convenience functions for determining information about power-of-2 sized
27 (*) Measuring power-of-2 buffers.
30 - The producer.
31 - The consumer.
41 (1) A 'head' index - the point at which the producer inserts items into the
44 (2) A 'tail' index - the point at which the consumer finds the next item in
53 indices should be wrapped to 0 when they reach the end of the buffer, thus
58 than 1 if multiple items or variable-sized items are to be included in the
60 be careful, however, as a region more than one unit in size may wrap the end of
63 Measuring power-of-2 buffers
68 modulus (divide) instruction. However, if the buffer is of a power-of-2 size,
69 then a much quicker bitwise-AND instruction can be used instead.
71 Linux provides a set of macros for handling power-of-2 circular buffers. These
91 which items can be immediately inserted without having to wrap back to the
102 (#) Measure the non-wrapping occupancy of a buffer::
107 the buffer without having to wrap back to the beginning of the buffer.
110 Each of these macros will nominally return a value between 0 and buffer_size-1,
131 independent and may be made on different CPUs - so the result in such a
152 ------------
158 unsigned long head = buffer->head;
160 unsigned long tail = READ_ONCE(buffer->tail);
162 if (CIRC_SPACE(head, tail, buffer->size) >= 1) {
168 smp_store_release(buffer->head,
169 (head + 1) & (buffer->size - 1));
186 element currently being read by the consumer. Therefore, the unlock-lock
193 ------------
200 unsigned long head = smp_load_acquire(buffer->head);
201 unsigned long tail = buffer->tail;
203 if (CIRC_CNT(head, tail, buffer->size) >= 1) {
211 smp_store_release(buffer->tail,
212 (tail + 1) & (buffer->size - 1));
236 See also Documentation/memory-barriers.txt for a description of Linux's memory