From owner-svn-src-all@freebsd.org Fri Jan 22 11:37:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C96F4A8D021; Fri, 22 Jan 2016 11:37:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 9248A1B19; Fri, 22 Jan 2016 11:37:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id B316DD60F80; Fri, 22 Jan 2016 22:37:30 +1100 (AEDT) Date: Fri, 22 Jan 2016 22:37:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: araujo@freebsd.org cc: Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r294543 - head/usr.sbin/ypldap In-Reply-To: Message-ID: <20160122222751.S1946@besplex.bde.org> References: <201601220302.u0M32dW2089530@repo.freebsd.org> <20160122173028.H966@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=R4L+YolX c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=fqvjmWVvM7xK5jY61XAA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2016 11:37:40 -0000 On Fri, 22 Jan 2016, Marcelo Araujo wrote: > 2016-01-22 15:57 GMT+08:00 Bruce Evans : >> ... >> Unfortunately, getdtablesize() is still needed for arrays as used in yp*, >> and for anything using select(). If getdtablesize() is large then the >> arrays should be sparse or large fd's should not be actually used. >> closefrom() should probably be used early to kill unknown fd's to make >> space for private fd's. After that, getdtablesize() becomes almost >> useless. You just allocate a table large enough for the fd's that >> you allocate, and don't allocate fd's sparsely. >> ... > > I noticed that getdtablesize(2) specifically for ypldap(8) case is a bit > slower than FD_SETSIZE, mostly because of the size of max_fd. freefall actually takes only 0.11 seconds to close 706977 mostly-non-open fd's. But if you watch this using ktrace (with ktrace.out on nfs) it takes 2.79 seconds for 1000 fd's or 33 minutes. ktrace on nfs is unusably slow. > However, as ypldap(8) was imported from OpenBSD seemed good to keep it as > much as synced with OpenBSD implementation. Although I'm not sure if > FreeBSD and OpenBSD shares the same getdtablesize(2) implementation. How did it diverge in the first place? getdtablesize(2)'s implementation can't be much different, but its value should be. Allowing 706977 fd's for a single thread should be considered a security hole (just a denial of service one). > Not an excuse for sure, but I agree with you!!! Bruce