Opened 9 years ago

Closed 9 years ago

#11026 closed Bug Report - General (fixed)

mythpreviewgen is run with too high a scheduling priority; causes stuttering playback

Reported by: O Lupton <oliverlupton@…> Owned by: Raymond Wagner
Priority: minor Milestone: 0.27
Component: MythTV - Mythpreviewgen Version: 0.25-fixes
Severity: medium Keywords: mythpreviewgen, nice, ionice
Cc: Ticket locked: no


mythpreviewgen seems to be run by default with too high a cpu/io scheduling priority. This causes stuttering playback (particularly for HD content) if a preview is generated in the background (for example, storing a bookmark in the recording you are watching updates the preview and makes the playback stutter).

For the moment I am working around this by moving mythpreviewgen to mythpreviewgen.real and putting this script in its place:

$ cat bin/mythpreviewgen 
ionice -c 2 -n 7 nice -n 19 /usr/bin/mythpreviewgen.real --seconds 250 "$@"

(this is less annoying, but the --seconds parameter is there because I can't find another way of telling Myth how far too seek)

It would be neater if MythTV could automatically reduce the priority of the mythpreviewgen process.

This seems to have been mentioned on the mailing list in the past, but I couldn't find any tickets relating to it - apologies if I missed one.

Attachments (1)

11026_1.patch (6.8 KB) - added by Raymond Wagner 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by J.Pilk@…

My mythcutprojectx script calls mythpreviewgen with ionice -c3, (idle). I use it regularly and I haven't noticed stuttering; but recently danielk pointed out that ionice only works with the default 'cfp' scheduler, whereas I have for years used 'escalator=deadline' when booting the kernel. I use ionice -c3 in several other places too, but wonder if I ought to be using something else. It certainly doesn't deliver on this quote from 'man ionice' : "The impact of an idle I/O process on normal system activity should be zero."

comment:2 Changed 9 years ago by Raymond Wagner

Milestone: unknown0.27
Owner: set to Raymond Wagner
Status: newaccepted

comment:3 Changed 9 years ago by Raymond Wagner

The attached patch converts the preview generator to the new MythSystem? syntax, and uses it to apply the 'nice' and 'ionice' values internally. It has been compile tested, but not runtime tested.

Changed 9 years ago by Raymond Wagner

Attachment: 11026_1.patch added

comment:4 Changed 9 years ago by managementboy@…

have been testing the patch for 2 weeks, no problem

comment:5 Changed 9 years ago by Raymond Wagner <rwagner@…>

In ecfa569b5df0ce761cda08a211f31b9cfc3ca1fd/mythtv:

Add mechanism to MythSystem? for log argument passthrough.

This adds the kMSPropagateLogs bit to the flags accepted by MythSystem?,
for use with MythTV binaries. If enabled, it will automatically append
the necessary command line logging arguments, as a String or StringList?,
which ever is appropriate.

Refs #11026

comment:6 Changed 9 years ago by Raymond Wagner <rwagner@…>

Resolution: fixed
Status: acceptedclosed

In 1efa59b1c619013ee35b54bea6a9efecbec3b19f/mythtv:

Convert previewgenerator to MythSystem? and apply nice settings.

This converts the calls that run the Preview Generator externally from
the old myth_system help function to the new MythSystem? class. This
change is necessary to apply nice and ionice values to the external
task, to prevent it from interfering with other, more time sensitive

Fixes #11026

Note: See TracTickets for help on using tickets.