[mythtv] ringbuffer.cpp

Jonas Arndt jonas.arndt at thearndtfamily.com
Fri Feb 14 22:33:25 UTC 2014


> "If you do need guarantees about the consistency of your data on disk 
> or the order in which it hits disk, there are several solutions: For 
> file-based I/O, you can pass O_SYNC to open(2) or use the fsync(2), 
> fdatasync(2), or sync_file_range(2) system calls. For mapped I/O, use 
> msync(2)."
>
> I'm wonder - are we using any from above in reader thread?
So digging further I discovered that the ThreadedFileWriter::Sync(void) 
is calling fdatasync. This is called by the RingBuffer::Sync(void), 
which used to be called by the NuppelVideoRecorder in the WriteVideo 
function. Except that it is commented out. Looking at git I can't see 
when (too old). I found this entry in the mailing list though about a 
noisy hard drive
http://www.mythtv.org/pipermail/mythtv-dev/2003-June/010629.html

There is really nothing else that is calling ThreadedFileWriter::Sync(void)

I am building it with Sync enabled now and see what happens. Perhaps my 
hard drive gets noisy;-)

>
> BTW:
> When I had old, 512byte sector HDD, following settings allowed me to 
> have zero "TFW(/myth/tv/8027_20140214090200.mpg:384): write(57528) cnt 
> 38 total 2259196 -- took a long time, 1702 ms" during tests with 16HD 
> concurrent streams on single SATA HDD.
>
> # ==============================================================
> #
> # dirty_writeback_centisecs
> #
> # The kernel flusher threads will periodically wake up and write `old' 
> data
> # out to disk.  This tunable expresses the interval between those 
> wakeups, in
> # 100'ths of a second.
> #
> # Setting this to zero disables periodic writeback altogether.
> # by https://bugzilla.kernel.org/show_bug.cgi?id=12309
> # every 5 sec kernel looks up for dirty status
> # This setting for smooting writebacking. Maybe 100 will be
> # even better.
> # echo 300    > /proc/sys/vm/dirty_writeback_centisecs
> # Default is 500
>
> vm.dirty_writeback_centisecs = 100
>
> # ==============================================================
>
>
> # ==============================================================
> #
> # dirty_background_bytes
> #
> # Contains the amount of dirty memory at which the background kernel
> # flusher threads will start writeback.
> #
> # Note: dirty_background_bytes is the counterpart of 
> dirty_background_ratio. Only
> # one of them may be specified at a time. When one sysctl is written 
> it is
> # immediately taken into account to evaluate the dirty memory limits 
> and the
> # other appears as 0 when read.
> #
> # Default is <empty>
>
> vm.dirty_background_bytes = 102400
>
> # ==============================================================
>
>
> # ==============================================================
> #
> # dirty_expire_centisecs
> #
> # This tunable is used to define when dirty data is old enough to be 
> eligible
> # for writeout by the kernel flusher threads.  It is expressed in 100'ths
> # of a second.  Data which has been dirty in-memory for longer than this
> # interval will be written out next time a flusher thread wakes up.
> #
> # Default is 3000
>
> vm.dirty_expire_centisecs = 864000
>
> # ==============================================================
>
>
> # ==============================================================
> #
> # dirty_bytes
> #
> # Contains the amount of dirty memory at which a process generating 
> disk writes
> # will itself start writeback.
> #
> # Note: dirty_bytes is the counterpart of dirty_ratio. Only one of 
> them may be
> # specified at a time. When one sysctl is written it is immediately 
> taken into
> # account to evaluate the dirty memory limits and the other appears as 
> 0 when
> # read.
> #
> # Note: the minimum value allowed for dirty_bytes is two pages (in 
> bytes); any
> # value lower than this limit will be ignored and the old 
> configuration will be
> # retained.
>
> # dirty_bytes = 16777216
>
> # ==============================================================
>
>
> # ==============================================================
> #
> # dirty_ratio
> #
> # Contains, as a percentage of total available memory that contains 
> free pages
> # and reclaimable pages, the number of pages at which a process which is
> # generating disk writes will itself start writing out dirty data.
> #
> # The total avaiable memory is not equal to total system memory.
> #
> # Default is 20
>
> vm.dirty_ratio = 2
>
> # ==============================================================
>
>
> # ==============================================================
> #
> # swappiness
> #
> # This control is used to define how aggressive the kernel will swap
> # memory pages.  Higher values will increase agressiveness, lower values
> # decrease the amount of swap.
> #
> # The default value is 60.
>
> vm.swappiness = 0
>
> # ==============================================================
>
> Now, when I move to 4k sector HDD  -default kernel settings seems to 
> be OK.
> Honestly speaking, do don't believe in correlation between sector size 
> and pdfluser efficiency - so maybe there is pure coincidence between 
> HDD change and good performance on VM defaults. But anyway - You can 
> try to play with above knobs...
>
> BTW2: I would love to see this thread in MythTV forums - so I can 
> read/replay anywhere via browser - instead of only in mailer program :-p
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org



More information about the mythtv-dev mailing list