From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2017 17:57:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,191,1484035200"; d="scan'208";a="51049462" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 21 Feb 2017 17:57:08 -0800 Date: Wed, 22 Feb 2017 09:59:31 +0800 From: Yuanhan Liu To: Matthias Gatto Cc: dev@dpdk.org 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 Content-Disposition: inline In-Reply-To: <20170221142530.31472-1-matthias.gatto@outscale.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] vhost: try to shrink pfdset when fdset_add fails X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 01:57:11 -0000 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