From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbdJWJ3m (ORCPT ); Mon, 23 Oct 2017 05:29:42 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:37240 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbdJWJ3k (ORCPT ); Mon, 23 Oct 2017 05:29:40 -0400 Date: Mon, 23 Oct 2017 11:29:39 +0200 From: Pavel Machek To: "Michael Kerrisk (man-pages)" Cc: Alexey Dobriyan , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, rdunlap@infradead.org, tglx@linutronix.de, tixxdz@gmail.com, gladkov.alexey@gmail.com, Aliaksandr Patseyenak Subject: Re: [PATCH 1/2 v2] fdmap(2) Message-ID: <20171023092938.GC32228@amd> References: <20170924200620.GA24368@avx2> <9bc11ace-d111-cdef-5280-8cdda027ae9a@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nmemrqcdn5VTmUEE" Content-Disposition: inline In-Reply-To: <9bc11ace-d111-cdef-5280-8cdda027ae9a@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nmemrqcdn5VTmUEE Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > From: Aliaksandr Patseyenak > >=20 > > Implement system call for bulk retrieveing of opened descriptors > > in binary form. > >=20 > > Some daemons could use it to reliably close file descriptors > > before starting. Currently they close everything upto some number > > which formally is not reliable. Other natural users are lsof(1) and CRIU > > (although lsof does so much in /proc that the effect is thoroughly buri= ed). > >=20 > > /proc, the only way to learn anything about file descriptors may not be > > available. There is unavoidable overhead associated with instantiating > > 3 dentries and 3 inodes and converting integers to strings and back. > >=20 > > Benchmark: > >=20 > > N=3D1<<22 times > > 4 opened descriptors (0, 1, 2, 3) > > opendir+readdir+closedir /proc/self/fd vs fdmap > >=20 > > /proc 8.31 =B1 0.37% > > fdmap 0.32 =B1 0.72% >=20 > >From the text above, I'm still trying to understand: whose problem > does this solve? I mean, we've lived with the daemon-close-all-files > technique forever (and I'm not sure that performance is really an=20 > important issue for the daemon case) . And you say that the effect Binary fdmap looks... quite ugly to me. But close_all(from, to) syscall kindof makes sense to me... and is not that ugly. Given that openbsd has something similar... perhaps we can take that? Except during startup, application should have good idea what fds it has open, so maybe that's enough? Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --nmemrqcdn5VTmUEE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlnttoIACgkQMOfwapXb+vIW5wCgt3SY4RhrKfcSormjhK71xAPK PUwAn2SQNavXg0j/w7dyikZa9uFohG+/ =RAud -----END PGP SIGNATURE----- --nmemrqcdn5VTmUEE--