Re: [PATCH 3/3] ring-buffer: add design document

Steven Rostedt
2009-06-11T03:25:54Z

On Thu, 11 Jun 2009, Hidetoshi Seto wrote:
> Steven Rostedt wrote:
> > +
> > + +------+
> > + |reader| RING BUFFER
> > + |page |-------------------+
> > + +------+ <---------------+ v
> > + | ^ +---+ +---+ +---+
> > + | | | |-->| |-->| |
> > + | | | |<--| |<--| |<-+
> > + | | +---+ +---+ +---+ |
> > + | | | ^ | |
> > + | | +-------------+ | |
> > + | +-----------------------------+ |
> > + +------------------------------------+
>
> It seems the middle of three pages have 2 prev arrows... ?

Yes that is a mistake. Thanks, I'll fix it.
> > +
> > +It does a cmpxchg with the pointer to the previous head page to make it
> > +point to the reader page. Note that the new pointer does not have the HEADER
> > +flag set. This action atomically moves the head page forward.
> > +
> > + +------+
> > + |reader| RING BUFFER
> > + |page |-------H-----------+
> > + +------+ <---------------+ v
> > + | ^ +---+ +---+ +---+
> > + | | | |-->| |-->| |
> > + | | | |<--| |<--| |<-+
> > + | | +---+ +---+ +---+ |
> > + | | | ^ | |
> > + | | +-------------+ | |
> > + | +-----------------------------+ |
> > + +------------------------------------+
> > +
>
> Ditto.

Ditto too ;-)

Thanks,

-- Steve