From: Eric Blake <eblake@redhat.com>
To: cygwin-developers@cygwin.com
Subject: Re: src/winsup/cygwin ChangeLog fhandler_proc.cc f ...
Date: Thu, 09 Oct 2014 15:07:00 -0000 [thread overview]
Message-ID: <5436A4AC.4000605@redhat.com> (raw)
In-Reply-To: <20141009145128.GA25442@calimero.vinschen.de>
[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]
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().
>
> 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.
>
> 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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-10-09 15:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20141009132437.7650.qmail@sourceware.org>
2014-10-09 14:31 ` Eric Blake
2014-10-09 14:51 ` Corinna Vinschen
2014-10-09 15:07 ` Eric Blake [this message]
2014-10-09 16:22 ` Corinna Vinschen
2014-10-09 17:47 ` Corinna Vinschen
2014-10-09 18:07 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5436A4AC.4000605@redhat.com \
--to=eblake@redhat.com \
--cc=cygwin-developers@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).