[LEDE-DEV] [PATCH] ubusd: Use linked list for queued messages

Alexandru Ardelean ardeleanalex at gmail.com
Thu May 3 02:46:47 PDT 2018


On Thu, May 3, 2018 at 12:07 PM, Felix Fietkau <nbd at nbd.name> wrote:
> Hi Benjamin,
>
> On 2018-05-02 22:55, Benjamin Hansmann wrote:
>> The fixed size array for queuing messages led to discarding messages
>> when it was full, using a linked list instead solves this issue.
>>
>> Having the list_head link in the ubus_msg_buf itself avoids the
>> allocation of more memory for an independent list.
>>
>> The motivation was that for a recursive "ubus list" the function
>> ubusd_proto.c:ubusd_handle_lookup() produces more than n messages in
>> one uloop cycle when n objects are registered on the bus.
>>
>> Signed-off-by: Benjamin Hansmann <i at qbox.audio>
> The reason for using an array is that a message can be queued for
> multiple clients. Doing that with your patch could corrupt the list in
> that case.
>

Hmm, I also forgot about this stuff.
Since ubus events rely on the sharing of messages.

It sounds like there would be 2 options to handle this.
1) Make the TX queue configurable at compile-time [default being 32 as is now]
2) Do a realloc of the queue array, and potentially a realloc() back
to a stable state after a grace period ; similar to the
`msgbuf_reduction_counter` logic in libubus-io

> - Felix
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev



More information about the Lede-dev mailing list