From owner-svn-src-all@freebsd.org Fri Jan 22 11:47:13 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 0E642A8D390; Fri, 22 Jan 2016 11:47:13 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-oi0-x234.google.com (mail-oi0-x234.google.com [IPv6:2607:f8b0:4003:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C529210F7; Fri, 22 Jan 2016 11:47:12 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-oi0-x234.google.com with SMTP id o124so45475282oia.3; Fri, 22 Jan 2016 03:47:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=3xbP1v/8UIKg04wlL2Qt89QEGD1zMRZMVdfrC3PaBL8=; b=HzwVuTiYFlnI2K+GLTE+mmbDuSuHiVMVmHZ+Yn89nztrOtZKsaDxDG+RMBn9CU7mUa VbRYASn5lA8Pgl7/2ZokiYDyBvwGQRm8mJyGIkpOG99unDZfBtD9HQQIvJbqQ+F2G2C/ 3OYFWhL5KrPkrYltVkV33IMSMuFiNU85Wy7PBlAJNH1N+qMI3ELj1UUlz3RsODm1y3IX Q0LK2zYgKGgXO3Pne5CIgWF39Zzxg9Q0tYpYINg1bV77KwyjK6QAk3mxmmsXQQzAA9BI kigYs2An5cGGQUfmz9dzPaeffIpzhpoKb6k4rt4aBKMq6bFDNmpBTLRKXaF7Z/aZhUsh FE4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=3xbP1v/8UIKg04wlL2Qt89QEGD1zMRZMVdfrC3PaBL8=; b=kP5vJwhuxftykouC4U5WMvPLQULe5LyCv+mElowAGll4IueraIY7QJIlnIHN2xmq4L yhiJksnmgBvXHAUECjitgQ7Gb6XY/nw+3PmSS6fRI66OnCMQYObAcwQLGaEadY4m2QtR swr91/g70UT3Xbv8zkoT2hobOizxOGbjE+eOkuJO5P0GyaUkRhHmi3xaGwAu4dS64H4g 05ZrpLQjeu+3BgPBFEnXB12nsitpgo9vpQbJMDmLzYbOkF7XCiWwWiKYRpACTsgKOB1D bXvk+sok9VTNPb17NbRtk7tkbBB6ZSUo2QA/zRNXzlIKe5fxm8I01Ye5bOwHBB9KTT5V HC7w== X-Gm-Message-State: AG10YOR+T5fQK8rAIeP9je6KnHjLWGKRZYBb7U52aNB4hGSTZllXeFbfUMYGGimyEz1WKAeSx0Z9YlLizpF+ZQ== MIME-Version: 1.0 X-Received: by 10.202.210.151 with SMTP id j145mr1882823oig.114.1453463231131; Fri, 22 Jan 2016 03:47:11 -0800 (PST) Received: by 10.182.40.194 with HTTP; Fri, 22 Jan 2016 03:47:11 -0800 (PST) Reply-To: araujo@FreeBSD.org In-Reply-To: <20160122222751.S1946@besplex.bde.org> References: <201601220302.u0M32dW2089530@repo.freebsd.org> <20160122173028.H966@besplex.bde.org> <20160122222751.S1946@besplex.bde.org> Date: Fri, 22 Jan 2016 19:47:11 +0800 Message-ID: Subject: Re: svn commit: r294543 - head/usr.sbin/ypldap From: Marcelo Araujo To: Bruce Evans Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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:47:13 -0000 2016-01-22 19:37 GMT+08:00 Bruce Evans : > 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. > I will check the yp(8) code to see how complex would be to get those getdtablesize(2) removed from there. > > 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? > Mostly I fixed a bug, made a small benchmark and noticed that "not using getdtablesize(2)" would be fast, also for ypldap(8) I really don't see any case to have more than 1024 FD allocated, but in other hands, keep the code synced as closes as possible will make easy for future sync with OpenBSD. That was the main reason why I bring back getdtablesize(2). > > 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). The good part of getdtablesize(2) is the tunable part, however for ypldap(8), I really don't need that. The change was mostly to don't diverge too much from OpenBSD. > > > Not an excuse for sure, but I agree with you!!! >> > > Bruce > Best, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)