[PATCH] Implementation of the sendgroup() system call

From: Elad Lahav
Date: Sun May 03 2009 - 22:07:06 EST


The attached patch contains an implementation of sendgroup(), a system call that allows a UDP packet to be transmitted efficiently to multiple recipients. Use cases for this system call include live-streaming and multi-player online games.
The basic idea is that the caller maintains a group - a list of IP addresses and UDP ports - and calls sendgroup() with the group list and a common payload. Optionally, the call allows for per-recipient data to be prepended or appended to the shared block. The data is copied once in the kernel into an allocated page, and the per-recipient socket buffers point to that page. Savings come from avoiding both the multiple calls and the multiple copies of the data required with regular socket operations. We have measured an improvement of 42% in CPU utilisation when using this system call with the Helix multimedia server (reference: http://simula.no/~griff/nossdav2008/27-32.pdf).

The patch includes two implementations: one as described above and one that uses the udp_sendmsg() function in a tight loop inside the kernel (and thus saves on mode switches, but not on data copies). The latter is provided for reference and benchmarking only.

Feedback is welcome.

--Elad

Attachment: sendgroup.tar.gz
Description: application/gzip