On Fri, 2011-05-20 at 15:27 +0200, Hadrien Caron wrote:
> Hello, I am new to using the Xenomai API and I have a basic question
> regarding
> the error indicator I just received.
> 
> I send large amount of data through pipe using rt_pipe_read and

You likely mean rt_pipe_write().

>  eventually get a return error of -ENOMEM
> 
> On the documentation I saw that :
> 
> -ENOMEM is returned if not enough buffer space is available to
> complete the operation.
> 
> I suppose the buffer refers to the internal buffer of the pipe to
> which the data is copied.
> I don't understand what I am supposed to do in order to free space on
> that buffer so that there
> is enough memory.
> 
> Could someone give some information about how the buffer is handled ?
> 

The real-time sender via rt_pipe_write() pulls memory from an internal
allocator, and that memory is released when the non real-time side reads
from its endpoint. So you get -ENOMEM likely because the latter does not
read fast enough.

Possible options:

- increase the size of the system heap, which is being used when no
private memory pool has been defined for the pipe. See
CONFIG_XENO_OPT_SYS_HEAP in your kernel .config.

- assign a private memory pool to the pipe via rt_pipe_create()'s
poolsize parameter, large enough to cope with the throughput. The
message space won't be pulled from the system heap in that case, but
from the private pool, which will be entirely reserved for that purpose.

- implement some sort of congestion control between the write and the
read sides, to avoid depleting the memory pool on the write side, by
waiting for the read side to pick up the messages when some watermark is
reached. Of course, this introduces a priority inversion, so whether it
is acceptable depends on your requirements.

- read the data faster from the non real-time endpoint, or send it
slower from the write side.

> Thank you very much in advance.
> 
> Regards,
> 
> Hadrien Caron 
> _______________________________________________
> Xenomai-help mailing list
> [email protected]
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.



_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to