Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Prebuffering pauses and CFS

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


mtdean at thirdcontact

Sep 14, 2008, 1:39 PM

Post #1 of 5 (2327 views)
Permalink
Prebuffering pauses and CFS

No, this has nothing to do with CIFS, the network filesystem.

Recently, I upgraded my MythTV frontend system from an Athlon X2 4800+
to an Athlon X2 6000+. I had always been able to use my old system to
play back HDTV without any problems--even allowing timestretch.

So, when I set up my new system and was unable to play back HDTV at
anything >1.0x without severe prebuffering pauses (and using the same
OS/Myth install), I knew I had an issue. After testing for the usual
hardware-related issues (sound card/sound drivers/sound config,
NIC/network performance), I ruled out hardware as the cause.

Finally, after way too much digging around, I figured out that the Linux
process scheduler was causing the issues. When upgrading the hardware,
I switched to a mobo that had a chipset that wasn't supported by my old
kernel, so I built a new kernel. In the process, I enabled the
Completely Fair Scheduler (CFS, a process scheduler) and Completely Fair
Queuing (CFQ, an I/O scheduler). It turns out that the CFS
configuration was broken and my BOINC/SETI [at] hom (running at nice 19) was
causing the problems (and would have caused even more problems--probably
preventing 1x playback--on lower-powered systems).

When I enabled CFS, I chose to enable GROUP_SCHED ("Group CPU
scheduler", "This feature lets CPU scheduler recognize task groups and
control CPU bandwidth allocation to such task groups.") and chose
USER_SCHED as the value for "Basis for grouping tasks", where USER_SCHED
means, "This option will choose userid as the basis for grouping tasks,
thus providing equal CPU bandwidth to each user." Since my mythfrontend
was running as the mythtv user and my boinc was running as a different
user, the scheduler was ensuring that boinc got its fair share of CPU
time--exactly what I had tried to prevent with nice/ionice'ing the
process. The only way to work around this issue with USER_SCHED is to
ensure both processes--mythfrontend and boinc--ran as the same user
(such that the relative nice values were the determining factor for
priority).

Instead, I chose to change the kernel configuration (which requires a
kernel recompile) to use "CGROUP_SCHED", which means "This option allows
you to create arbitrary task groups using the 'cgroup' pseudo filesystem
and control the cpu bandwidth allocated to each such task group. Refer
to Documentation/cgroups.txt for more information on 'cgroup' pseudo
filesystem." With this configuration, all processes start in the same
default cgroup, meaning--without any explicit configuration--the nice
value is the determining factor for prioritization. A better
configuration is to actually create a control group, i.e. "background"
with a /very/ low cpu.share (i.e. since cpu.share is a relative priority
mechanism, specific values are irrelevant, and since the default
cpu.share is 1024, setting processes in the background cgroup to 2
definitely ensures they don't cause problems :). This approach provides
unlimited control over CPU prioritization--you could even create
multimedia or database or ... cgroups and give them higher priority than
even the default cgroup (so they would get higher priority than
services, like SSH, etc.).

The main reason I'm mentioning this in its own thread is that there have
been a /lot/ of threads on prebuffering pauses "with plenty of CPU" that
may be due to this misconfiguration. From digging through the 'net for
information, it looks like a large number of distros are shipping
kernels configured to use GROUP_SCHED with USER_SCHED, so if you're
running processes--especially CPU-hungry processes, like MySQL or
BOINC--on your frontend systems as different users, you may need to fix
things.***

Mike

***"Fixing things" (and figuring out how best to "fix things") is left
as an exercise for the reader. :)
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


jra at baylink

Sep 14, 2008, 7:46 PM

Post #2 of 5 (2209 views)
Permalink
Re: Prebuffering pauses and CFS [In reply to]

----- "Michael T. Dean" <mtdean [at] thirdcontact> wrote:
> No, this has nothing to do with CIFS, the network filesystem.

[. long saga which really truly doesn't have anything to do with CIFS elided ]

Wiki?

Cheers,
- jra
--
Jay R. Ashworth Baylink jra [at] baylink
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Josef Stalin)

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mtdean at thirdcontact

Sep 14, 2008, 8:38 PM

Post #3 of 5 (2213 views)
Permalink
Re: Prebuffering pauses and CFS [In reply to]

On 09/14/2008 10:46 PM, Jay R. Ashworth wrote:
> ----- "Michael T. Dean" wrote:
>
>> No, this has nothing to do with CIFS, the network filesystem.
>>
>
> [. long saga which really truly doesn't have anything to do with CIFS elided ]
>
> Wiki?

Point taken. Will do. Thanks for the reminder. :)

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mtdean at thirdcontact

Sep 14, 2008, 10:40 PM

Post #4 of 5 (2201 views)
Permalink
Re: Prebuffering pauses and CFS [In reply to]

On 09/14/2008 11:38 PM, Michael T. Dean wrote:
> On 09/14/2008 10:46 PM, Jay R. Ashworth wrote:
>
>> ----- "Michael T. Dean" wrote:
>>
>>
>>> No, this has nothing to do with CIFS, the network filesystem.
>>>
>>>
>> [. long saga which really truly doesn't have anything to do with CIFS elided ]
>>
>> Wiki?
>>
>
> Point taken. Will do. Thanks for the reminder. :)
>

http://www.mythtv.org/wiki/index.php/Troubleshooting:Prebuffering_pause#Kernel_Scheduler_Misconfiguration
and, while I'm at it, I'm cleaning up and adding several other missing
causes/descriptions to the page.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


ylee at pobox

Sep 15, 2008, 2:32 PM

Post #5 of 5 (2162 views)
Permalink
Re: Prebuffering pauses and CFS [In reply to]

Michael T. Dean <mtdean [at] thirdcontact> says:
> The main reason I'm mentioning this in its own thread is that there
> have been a /lot/ of threads on prebuffering pauses "with plenty of
> CPU" that may be due to this misconfiguration. From digging through
> the 'net for information, it looks like a large number of distros
> are shipping kernels configured to use GROUP_SCHED with USER_SCHED,

I run CentOS 5 (kernel 2.6.18) and Fedora 6 (2.6.20) on my MythTV
boxes. CGROUP_SCHED and the other options appear to have been added to
the kernel in 2.6.24, so it's not an issue for me, fortunately.

It definitely was an issue for Ubuntu (and thus, I presume, Mythbuntu)
users earlier this year, especially multimedia-using ones; see
<URL:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/188226> for
the whole tragic/sad story.

--
Frontend: P4 3.0GHz, 1.5TB software RAID 5 array
Backend: Quad-core Xeon 1.6GHz, 6.6TB sw RAID 6
Video inputs: Four high-definition over FireWire/OTA
Accessories: 47" 1080p LCD, 5.1 digital, and MX-600
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.