Re: [PATCH v3 1/4] IPC: Added two new system call mq_recvmmsg() and mq_sendmmsg()

Pavel Tikhomirov <[email protected]> Fri, 12 Jun 2026 15:52:14 +0200
Newsgroups dev.linux.lists.criu
Message-ID <[email protected]>

On 6/12/26 14:35, Mathura wrote:
> Hi,
> 
> I am resending this due to a mail server error.

Sorry, I accidentally replied with html and broke the formating.

> 
> I never tested in compat mode. I will do and look at all the points
> mentioned above.
> I will insist you to please do a complete review and kindly tell me if
> any more such or any architecture specific issue exists.
> 
> Regarding optimization on target retrieval from tree, can you provide
> any suggestion how we can minimize complete traversal required for
> each time. if we maintain state how we know the current cache or
> stored efficient node belongs to which system calls from userspace if
> we assume many concurrent processes calling it.

My idea was to basically just have `struct rb_node **last = NULL;`
in do_mq_recvmmsg() and pass it down to mq_peek_index(), so that we can
start the walk from last instead of rb_last, just doing `node = rb_prev(last)`
instead of full tree walk. You should set node back to last after that.
Only thing we should be careful about is that info->msg_tree
should be sufficiently locked to avoid removal of last from the tree.

> 
> Thanks,
> Mathura

-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.