Re: 10.6.2 issues with F_NOCACHE?
Re: 10.6.2 issues with F_NOCACHE?
- Subject: Re: 10.6.2 issues with F_NOCACHE?
- From: Marc Van Olmen <email@hidden>
- Date: Mon, 8 Feb 2010 15:05:29 -0500
Chris,
Thanks for your feedback. Marc --
A small snippet of fs_usage trace is not enough to conclude what entity is caching data. However, given our knowledge of ProApps workloads and how the system behaves when using apps like Final Cut Pro, I think the burden of proof lies on the developer to isolate their own code and see if it's causing the issue.
I understand but my questions is how does fs_usage reports a Cache hit in file cache log? I couldn't read that information in the documentation.
Within this code you seem to be allocating memory and freeing it, and copying data which was directly DMA'd into it to application supplied buffers. Both of those are not going to be very efficient for any sort of rich media application.
The memory is allocated once, during the application. The buffer is declared static, so this buffer stays alive on the next read. Like I said it just a quick prototype to see if a valloc buffer would solve the issue.
You really want to have a preallocated pool of buffers for use so you aren't constantly calling valloc()/free(). In addition, I'm not sure from the code snippet provided why you can't just read directly into the buffer passed into the Read() method. That would be the most efficient way to do a read with minimal copying. That is the point of direct I/O, right?
Currently the buffer passed in the read function is not valloc allocated. It is part of big Memory Buffer and the read buffer is an offset in that currently it is not page-aligned. The engine uses its own memory allocator optimized for video playback doesn't do malloc/free during playback. Code is written to work well on a G4. So is highly optimized for those old days.
I understand I'm not doing the smartest thing, I just made a quick prototype to see if I the valloc technique gave better result. So I use the global valloc buffer to read and then copy it into the buffer passed on by read. In the future will solve this in the proper way and make sure my buffer passed in the Read functions is page-aligned.
Finally, I believe the fcntl for F_RDAHEAD is redundant. I believe F_NOCACHE implies the system will only issue physical I/Os for the supplied buffer.
Good to know,
Thanks
marc
Thanks,
-- Chris
------------------ 6 Infinite Loop M/S 306-2MS Cupertino CA 95014 phone: (408) 974-4033 fax: (408) 862-7577
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden