From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH] vhost: try to shrink pfdset when fdset_add fails Date: Wed, 22 Feb 2017 09:59:31 +0800 Message-ID: <20170222015931.GK18844@yliu-dev.sh.intel.com> References: <20170221142530.31472-1-matthias.gatto@outscale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org To: Matthias Gatto Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E0B322A5E for ; Wed, 22 Feb 2017 02:57:10 +0100 (CET) Content-Disposition: inline In-Reply-To: <20170221142530.31472-1-matthias.gatto@outscale.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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