[dpdk-dev] [PATCH] vhost: try to shrink pfdset when fdset_add fails
Yuanhan Liu
yuanhan.liu at linux.intel.com
Wed Feb 22 02:59:31 CET 2017
On Tue, Feb 21, 2017 at 03:25:30PM +0100, Matthias Gatto wrote:
> fdset_add increment pfdset->num, but fdset_del doesn't decrement pfdset->num,
> so if we call fdset_add then fdset_del in a loop witout calling
> fdset_shrink, we can easily exceed MAX_FDS with only a few number of fds
> used.
I'm assuming you were doing some tests like following?
while true; do
ovs-vsctl add-port br vhost_n -- ...
ovs-vsctl del-port vhost_n
done
> So my solution is simply to call fdset_shrink in fdset_add
> when it exceed MAX_FDS.
>
> Because fdset_shrink and fdset_add locks pfdset->fd_mutex we can't call
> fdset_shrink inside fdset_add because that would cause a dead lock,
> so this patch split fdset_shrink in two, fdset_shrink amd fdset_shrink_nolock.
Looks good to me.
--yliu
More information about the dev
mailing list