All of
 help / color / mirror / Atom feed
From: Tom Zanussi <>
To: Gianni Tedesco <>
Cc: Tom Zanussi <>,,,
Subject: Re: [RFC][PATCH 0/5] relayfs
Date: Tue, 15 Jul 2003 13:45:45 -0500	[thread overview]
Message-ID: <16148.19417.800465.402070@gargle.gargle.HOWL> (raw)
In-Reply-To: <1058287227.377.17.camel@sherbert>

Gianni Tedesco writes:
 > On Tue, 2003-07-15 at 17:01, Tom Zanussi wrote:
 > >  > 
 > >  > Could this be used to replace mmap() packet socket, how does it compare?
 > > 
 > > I think so - you could send high volumes of packet traffic to a bulk
 > > relayfs channel and read it from the mmap'ed relayfs file in user
 > > space.  The Linux Trace Toolkit does the same thing with large volumes
 > > of trace data - you could look at that code as an example
 > > (
 > What are the semantics of the mmap'ing the buffer? With mmaped packet
 > socket the userspace (read-side) requires no sys-calls apart from when
 > the buffer is empty, it then uses poll(2) to sleep until something new
 > is put in the buffer. Can relayfs do a similar thing? poll is not
 > mentioned in the docs...

Just thinking a bit more about implementing poll() - that part should
be pretty simple, but how does the read-side know how much to read,
unless it's reading fixed-size blocks?  To do that without using a
system call or IOCTL or sysfs file, you could reserve a part of the
channel or a part of each sub-buffer (relayfs channels are subdivided
into a number of sub-buffers) for info the read-side would need in
order to read what's ready.  The rchan_start_reserve, start_reserve,
and end_reserve parameters to relay_open() are used for this purpose.
The one complication here is that if an event won't fit into the
current sub-buffer, the remainder will be filled with filler, and the
event will be put into the following sub-buffer.  The amount of filler
is available from within the buffer_end() callback, and this value
should also be part of the data the read-side would need in order to
process the event.  The size lost to filler shouldn't be an issue if
you use a large enough sub-buffer size and should be pretty easy to
account for in your user-side application.

LTT makes use of all of the above, but as a 'bulk' client, meaning it
processes complete sub-buffers, doesn't need to be super-efficient on
sub-buffer boundaries, and can get away with using a signal/syscall
protocol.  dynamic printk, another relayfs client, is a 'packet'
client, meaning its readers are notified after each completed write,
but its userspace app (klogd) basically loops on read(2).  What I
think you want is to be a 'packet' client, and to implement your
protocol using space reserved within the mmapped buffer.  I think
relayfs has all the elements you'd need to do this pretty easily, with
the exception of the poll(2) support, which is at the top of my todo

Hope this helps,


 > Thanks.
 > -- 
 > // Gianni Tedesco (gianni at scaramanga dot co dot uk)
 > lynx --source | gpg --import
 > 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D


Tom Zanussi <>
IBM Linux Technology Center/RAS

  parent reply	other threads:[~2003-07-15 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-15 15:15 [RFC][PATCH 0/5] relayfs Tom Zanussi
2003-07-15 15:27 ` Gianni Tedesco
2003-07-15 16:01   ` Tom Zanussi
2003-07-15 16:40     ` Gianni Tedesco
2003-07-15 17:01       ` Tom Zanussi
2003-07-15 18:45       ` Tom Zanussi [this message]
2003-07-16 21:55 ` [PATCH] relayfs Stephen Hemminger
2003-07-16 22:27   ` [PATCH] relay_open const filename Stephen Hemminger
2003-07-18 21:11   ` [PATCH] relayfs Tom Zanussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16148.19417.800465.402070@gargle.gargle.HOWL \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.