Mail Archives: cygwin/2007/01/17/14:43:41
---559023410-320655053-1169062978=:2732
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Wed, 17 Jan 2007, Corinna Vinschen wrote:
> On Jan 16 17:28, Brian Ford wrote:
>
> > PS: In an strace of this, I see three fstat64s called from within a
> > single mmap64. Do you know where they all are, and if two should be
> > optimized away?
>
> There's only one such call in list::set.
which is called from map::add_list, yes. I also see one in
map::get_list_by_fd.
> Your observation is strange. The first mapping, which really maps the
> file, calls fstat. The second (valid remainder) and third (sigbus area)
> mapping are anonymous mappings, which don't call fstat.
I don't think my three fstat64s correspond to your three mappings.
> In my tests, fstat64 is called only once for a file mapping.
Really? I think I see them as follows:
mmap.cc:1203 mmap64():
map_list = mmapped_areas.get_list_by_fd (fd);
mmap.cc:982 mmap_worker():
if (!(map_list = mmapped_areas.get_list_by_fd (fd))
mmap.cc:983 mmap_worker():
&& !(map_list = mmapped_areas.add_list (fd)))
Also:
mmap.cc:1134 mmap64():
DWORD low = GetFileSize (fh->get_handle (), &high);
> STC?
It looks like your statement is true for the first mmap in a process, but
subsequent mmaps have significant overhead. In the attached STC, I count
5 fstat64s of the same fd via strace, plus the GetFileSize mentioned
above.
PS. Since this isn't a bug, I don't expect you to do any more than
consider putting it in your long term low priority que or reply with a PTC
Thanks for the evaluation tuits ;-).
--
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...
---559023410-320655053-1169062978=:2732
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="mmaptest.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT CYG DOT 4 DOT 58 DOT 0701171342582 DOT 2732 AT PC1163-8460-XP DOT flightsafety DOT com>
Content-Description:
Content-Disposition: attachment; filename="mmaptest.c"
I2luY2x1ZGUgPGxpbWl0cy5oPg0KI2luY2x1ZGUgPHVuaXN0ZC5oPg0KI2lu
Y2x1ZGUgPHN5cy90eXBlcy5oPg0KI2luY2x1ZG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ciA9IG1tYXAoTlVMTCwgc2Iuc3Rfc2l6ZSwgKFBS
T1RfUkVBRHxQUk9UX1dSSVRFKSwNCgkJKE1BUF9OT1JFU0VSVkV8TUFQX1BS
SVZBVEUpLCBmZCwgMCk7DQogICAgaWYgKGFkZHIgPT0gTUFQX0ZBSUxFRCkN
CiAgICB7DQoJcGVycm9yKCJtbWFwMSIpOw0KCXJldHVybiAtMTsNCiAgICB9
DQoNCiAgICBhZGRyID0gbW1hcChOVUxMLCBzYi5zdF9zaXplLCAoUFJPVF9S
RUFEfFBST1RfV1JJVEUpLA0KCQkoTUFQX05PUkVTRVJWRXxNQVBfUFJJVkFU
RSksIGZkLCAwKTsNCiAgICBpZiAoYWRkciA9PSBNQVBfRkFJTEVEKQ0KICAg
IHsNCglwZXJyb3IoIm1tYXAyIik7DQoJcmV0dXJuIC0xOw0KICAgIH0NCg0K
ICAgIGNsb3NlKGZkKTsNCg0KICAgIHB1dHMoInRlc3QgcGFzc2VkIik7DQog
ICAgcmV0dXJuIDA7DQp9DQo=
---559023410-320655053-1169062978=:2732
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
---559023410-320655053-1169062978=:2732--
- Raw text -