|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] Switch from select() to poll() in xenconsoled's IO loop
On 08/01/13 12:52, Wei Liu wrote: Just to be clear, this is version 5 of the patch. Git send-email mysteriously dropped my subject prefix. Wei. On Tue, 2013-01-08 at 11:50 +0000, Wei Liu wrote:In Linux select() typically supports up to 1024 file descriptors. This can be a problem when user tries to boot up many guests. Switching to poll() has minimum impact on existing code and has better scalibility. pollfd array is dynamically allocated / reallocated. If the array fails to expand, we just ignore the incoming fd. Change from V2: * remove unnecessary malloc in initialize_pollfd_arrays * use ROUND_UP to get new size of arrays Change from V3: * remove initialize and destroy function for array * embedded tracking structure in struct domain, eliminate fd_to_pollfd Change from V4: * make xs_pollfd local to io.c * add back the 5 ms fuzz * handle POLLERR and POLLHUP * treat POLLPRI as error if set in revents * abort if xenconsoled's own fds get screwed * handle broken tty if tty's fds get screwed Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/console/daemon/io.c | 189 +++++++++++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 58 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 48fe151..8d16cac 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -28,7 +28,7 @@ #include <stdlib.h> #include <errno.h> #include <string.h> -#include <sys/select.h> +#include <poll.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> @@ -69,6 +69,7 @@ static int log_hv_fd = -1; static evtchn_port_or_error_t log_hv_evtchn = -1; static xc_interface *xch; /* why does xenconsoled have two xc handles ? */ static xc_evtchn *xce_handle = NULL; +static struct pollfd *xce_pollfd = NULL;struct buffer { Why is this not "static"? There seems to be no particular reason why these variables are here, and the other ones up the top of the file. For example xce_handle is not used "above" here, but it's declared at the top of the file. I think keeping all variables together makes more sense than scattering them around.+static struct pollfd *fds; +static unsigned int current_array_size; +static unsigned int nr_fds; Otherwise, looks good to me. -- Mats _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |