On Wed, Dec 21, 2016 at 10:06:36AM -0800, Stephen Hemminger wrote: > On Wed, 21 Dec 2016 17:45:13 +0800 > Yuanhan Liu <yuanhan....@linux.intel.com> wrote: > > > From: Jan Wickbom <jan.wick...@ericsson.com> > > > > Currently select() is used to monitor file descriptors for vhostuser > > ports. This limits the number of ports possible to create since the > > fd number is used as index in the fd_set and we have seen fds > 1023. > > This patch changes select() to poll(). This way we can keep an > > packed (pollfd) array for the fds, e.g. as many fds as the size of > > the array. > > > > Also see: > > http://dpdk.org/ml/archives/dev/2016-April/037024.html > > > > Reported-by: Patrik Andersson <patrik.r.anders...@ericsson.com> > > Signed-off-by: Jan Wickbom <jan.wick...@ericsson.com> > > Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com> > > Why not epoll()? It scales much better. The old System V poll > is just as bad with 1023 fd's.
Indeed, there was a plan to use epoll() to fix this issue. It's been delayed long enough that Jan came up with a fix with poll recently. I don't have strong preference to epoll() over poll, for following reasons: - epoll() is Linux only, though I don't know other platforms (mainly *BSD) actually care vhost-user or not. - epoll indeed scales much better, but I don't think the scale actually matters a lot here: vhost-user negotiation normally happens once on QEMU startup, and it's a short lived process. Both facts make it be non-performance critical. - 1023 is also not a big problem so far: vhost lib hardcodes the max vhost devices we could support to be 1024 after all. For above reasons and Jan already came up with a solution (that would work for most platforms), I think I'm fine with this poll() so far. --yliu