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: email@hidden
- Date: Thu, 4 Feb 2010 20:10:34 -0000 (UTC)
- Importance: Normal
Chris,
Thanks for the input, I will do some test tonight.
I know in my case this isn't, that's why I mentioned this:
--------------
Not sure important: my memory pointer that i pass into the read, is an
offset in a section of a big memory blob allocated with malloc.
--------------
Question: is it sufficient that the pointer address I pass is a multiple
of 4096 (in case page size on that platform is 4096) or do I have allocate
the memory in a special way. Because as far I recall Malloc creates and
aligned buffer, but not a page aligned buffer.
thanks,
marc
> Marc --
>
> To ensure proper F_NOCACHE behavior, you should really ensure you pass
> page-aligned buffers to read/pread. The buffer cache may decide it has
> to go through the copy path if your buffer is not well-aligned and
> your DMA controller requires better alignment.
>
> -- Chris
>
>
> On Feb 3, 2010, at 8:53 PM, Marc Van Olmen wrote:
>
>> hi,
>>
>> Just trying to trace an issue with my app:
>>
>> Our app runs fine under 10.5.8 (just retested this)
>>
>> The app plays a playlist of HD videos and about 20Mbytes/second data
>> rate. It plays a few of those clips in loop.
>> I'm using the standard unix open function to read from these files.
>>
>> fFileRef = open(fFilePath,O_RDONLY);
>>
>> if (fFileRef == -1) {
>> anError = kOS_Error_CouldntOpenFile;
>> goto bail;
>> }
>> BAIL_OSERROR(fcntl(fFileRef, F_NOCACHE, 1));
>>
>> (Also QuickTime has these files open, but I don't use Quicktime to
>> read) but maybe this is a cause.
>>
>> There is only one file open at the time. Also my app doesn't
>> allocate much memory once the video is playing. So the Application
>> memory is constant for most of the time.
>>
>>
>>
>> Under 10.6.2 I see something strange happening.Under Activity
>> Memory: the System Memory->Free is decreasing after playing above
>> clips for like 20 min.
>> Under System 10.5.8 this stays constant.
>>
>> My system has 3GB of ram. Under 10.5.8 this stays around 1.5GB free
>> available. Under 10.6.2 this goes to 200Mbytes after 20 min.
>>
>> After a while I notice the "Swap used" starts to grow a little under
>> 10.6.2 and this causes sometimes frame drops in my video playback
>> app. Under 10.5.8 this doesn't happen.
>>
>>
>> When I go to the Terminal (10.6.2) and I use the 'purge' command
>> Activity Memory: the System Memory->Free goes back 1.2 GBytes Free
>> memory.
>>
>> So this makes me assume that disk cache is being filled by my reading.
>>
>> I also tested this on a system with 6GB and above symptoms happening
>> also.
>>
>> I also tried doing this:
>>
>> BAIL_OSERROR(fcntl(fFileRef, F_RDAHEAD, 0));
>>
>> no difference. Same behavior under 10.6.2
>>
>> I tried:
>> BAIL_OSERROR(fcntl(fFileRef, F_GLOBAL_NOCACHE, 1));
>>
>> no difference. Same behavior under 10.6.2
>>
>> Not sure important: my memory pointer that i pass into the read, is
>> an offset in a section of a big memory blob allocated with malloc.
>>
>>
>> * Any suggestion on how to get rid of this problem? I
>> * Did something changed under 10.6 regarding F_NOCACHE?
>> * Any suggestion on how trace this issue better? Is there a way I
>> can trace when a read data is being added to the disk cache for
>> example?
>> I didn't see anything in Instruments->Disk Activity. Maybe I missed
>> something.
>>
>> I can file a radar in case needed but just double checking if I'm
>> overlooking something simple here.
>>
>> cheers,
>>
>> marc
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
> ------------------
> 6 Infinite Loop
> M/S 306-2MS
> Cupertino CA 95014
> phone: (408) 974-4033
> fax: (408) 862-7577
> email: email@hidden
>
>
_______________________________________________
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