From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3280 invoked by alias); 9 Oct 2014 15:07:28 -0000 Mailing-List: contact cygwin-developers-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com Received: (qmail 3257 invoked by uid 89); 9 Oct 2014 15:07:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Oct 2014 15:07:26 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s99F7PWP008831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 9 Oct 2014 11:07:25 -0400 Received: from [10.3.113.90] (ovpn-113-90.phx2.redhat.com [10.3.113.90]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s99F7OBP027696 for ; Thu, 9 Oct 2014 11:07:24 -0400 Message-ID: <5436A4AC.4000605@redhat.com> Date: Thu, 09 Oct 2014 15:07:00 -0000 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: cygwin-developers@cygwin.com Subject: Re: src/winsup/cygwin ChangeLog fhandler_proc.cc f ... References: <20141009132437.7650.qmail@sourceware.org> <54369C4E.2030708@redhat.com> <20141009145128.GA25442@calimero.vinschen.de> In-Reply-To: <20141009145128.GA25442@calimero.vinschen.de> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5lGTEDRDcjk1bhP6bqHxQu1gD2gLQgtrA" X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00002.txt.bz2 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5lGTEDRDcjk1bhP6bqHxQu1gD2gLQgtrA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1764 On 10/09/2014 08:51 AM, Corinna Vinschen wrote: >> The whole point of d_type is for optimization, to tell a process when it >> can avoid the overhead of an lstat() because the system was able to >> obtain the information in a cheaper manner. But if you have to resort >> to an lstat() to get the information, then you are wasting cycles on the >> case of a user that doesn't care about d_type. I'd rather we always >> return DT_UNKNOWN if the only way we'd get a better type is by calling >> lstat(). >=20 > I see. The idea here was to try and, at least on my machine, it > was still *very* fast, likely because the whole thing occurs only > in globally allocated memory and there's no disk access or paging > involved. >=20 > The question is, what exactly do we lose? /proc/sys isn't often > accessed at all (I guess) and what could be gained? Yaakov asked > for setting d_type under /proc, so he might enlighten us which > tools make heavy use of the stuff, so the net gain is > 0... Some modes of 'find' and 'ls' (such as ls -F) are faster if d_type is accurate (because they avoided an lstat); there, returning DT_UNKNOWN requires the lstat. In other cases (like ls -l) an lstat is always required. Anywhere that lstat is slow, embedding an lstat into d_type determination as well as a followup lstat is going to make directory traversal twice as slow (well, maybe the second call is faster because of caching effects); conversely, anywhere that lstat is not required by the caller, it is wasted effort during the readdir. But as you say, lstat in /proc/sys is mostly stuff in memory and already fast, so maybe it doesn't hurt to leave it in. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --5lGTEDRDcjk1bhP6bqHxQu1gD2gLQgtrA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 539 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUNqSsAAoJEKeha0olJ0NqNdoH/iYiKcyMsQKb6W+WkyT0h7Gw vcEJJl6BVedI1J/YL8WiZfTb+m0Rc19K12bocnrdwcMYanLEDMR0Lh2YMI4EaQ/1 Tk4VObJUXJqZxTqCFbpgA8l3Z+DZoa7dhcxMyy7CLrBX8ZeNZgePzKQqqgHOu3Qh fMCEutsTZppAKymSYho+dubhOzp5yq5/I41di9X2kBS1oOJkQZej48Lg3prpmOAn Sf8TQMwxlkQkeyLIeqtmE8M6yDLcVd6CCM9D5Zt09mM/D7iGOIYfK9HuZqSK/frs S6mjqjv+2v5QQSvkVDryMpVR8wrRNXlRVQAm9HJ1LoIDJcwJR9453Y3R/h5+huE= =opX+ -----END PGP SIGNATURE----- --5lGTEDRDcjk1bhP6bqHxQu1gD2gLQgtrA--