From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10155 invoked by alias); 9 Oct 2014 17:47:44 -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 10144 invoked by uid 89); 9 Oct 2014 17:47:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Oct 2014 17:47:42 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 9FD768E0A26; Thu, 9 Oct 2014 19:47:40 +0200 (CEST) Date: Thu, 09 Oct 2014 17:47:00 -0000 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: src/winsup/cygwin ChangeLog fhandler_proc.cc f ... Message-ID: <20141009174740.GA28398@calimero.vinschen.de> Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <20141009132437.7650.qmail@sourceware.org> <54369C4E.2030708@redhat.com> <20141009145128.GA25442@calimero.vinschen.de> <5436A4AC.4000605@redhat.com> <20141009162202.GB25442@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <20141009162202.GB25442@calimero.vinschen.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2014-10/txt/msg00004.txt.bz2 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2589 On Oct 9 18:22, Corinna Vinschen wrote: > On Oct 9 09:07, Eric Blake wrote: > > On 10/09/2014 08:51 AM, Corinna Vinschen wrote: > > >> The whole point of d_type is for optimization, to tell a process whe= n 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 reso= rt > > >> 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 calli= ng > > >> 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... > >=20 > > 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 > I made a quick test on 64 bit W8.1 and a non-opimized Cygwin DLL. >=20 > time ls -l --color=3Dalways /proc/sys/Device/ >=20 > takes a constant 0.53 secs without my patch, and a constant 0.83 secs > with my patch. So it's actually rather noticable, being more than 50% > slower. It's hard to justify such a hit... I applied another technique which has no noticable performance hit. It doesn't recognize all objects, only directories, symlinks, and partially character devices, but on the upside it uses only information which has already been provided anyway. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUNso8AAoJEPU2Bp2uRE+g6eMP/A6EovnGwQHV3PufOgkR/pa6 yI0STamtc9nhPRpu8I45pk+gXXDt4QtXby5wd/27OuYBDGAwnDuqqpiIMkSVpixp s1BGFmpM6O1SjSDOnQXVtBCTw1P8u+VbWPJ6rQnnvGXk8ZE2lSoYf1DJ/1h0piR/ iNcDgz0Gsve8w1JVktF6jxsNwowTK11rXlLImLedZoOeimPDkej7BWyLPu1FUDuu vqP3sYpni7Fs6M/uelenAZeOOltrwk4yhhH7lblqpZAbuBKaqy8CxeGiBMlbbZSC swIc94kbsHOyHj6zGa4U6rGyFg5A7sHT2AAV7NfFE1BrUBDofTd5/Y5gg5R4W4u+ 1Ix9yLrcoviR9OH3q/WRcnPvPyzk6N0utllj852yef5uLMF3exSkGMBGPTqqp7p8 5UTtz+WL7h2yhc+mNDJl8eAnNQVuVDUeFi1IFqcfG1jLZTT5//IR/tEQwtHMvgIo Z/iWMvNUc2VHWM3GJzMDA6UCk3sPyVRaCzn49NK1AP2pM2M0IWJZXxSBRcRV+6P+ OSzIt11GkrM+Qvk8ANugpUukpbOBFaUrjkunZmMwcwr6BPHQlH07azGccBjlFyo9 cpxRaVo4vBHKPUCKBNFT2EPgh6h+GX/EL983ipxk/a/It3y1pm6cKsZMgjQAA4SS 7ebo18KEnq2lprwXl0lo =MMdP -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--