[MPlayer-users] DVD playback issue on older notebook with not so old Linux kernel
eclipse7 at gmx.net
Sun May 24 18:49:04 EEST 2020
On 2020-05-17 20:45 +0200, Erik Auerswald wrote:
> Hello Alexander,
> On 17.05.20 13:07, Alexander Strasser wrote:
> > On 2020-05-15 11:05 +0200, Erik Auerswald wrote:
> > > I'd like to describe a DVD playback issue I encountered, and how to work
> > > around the problem, just in case someone else runs into it.
> > Did you have a look at the caching settings?
> > In particular -cache and -cache-min ?
> Yes, I did. I am using a 64MiB MPlayer cache for DVD playback with the
> default -cache-min setting.
> I have been using these settings for years on the exact same hardware.
> The playback issues described in this thread are relatively "new".
> (I reinstalled the notebook with Ubuntu 18.04 about a year ago.)
> Using no MPlayer cache for DVD playback, e.g., for dvdnav://, does not
> work well on that notebook.
> The playback problems usually occur late in the movie, even after
> pausing the playback (which should give the cache time to fill).
> Swap stays usually empty on that system, but directly after the first
> stutter during DVD playback, swap is used. After each stutter, more
> swap is used. Disabling swap has so far reliably prevent the issue.
> The stuttering "feels" just like Linux's whole system stalls on write
> back. Since I do not have an HDD LED on the notebook, I cannot easily
> see if HDD activity and DVD playback problems coincide. I do think that
> my conclusions are plausible (and disabling swap works for me ;).
Ok, I suspected it wouldn't be that easy to tame the problem.
Unfortunately currently I have no DVD drive around. When I have access to
a DVD drive again, I will try to reproduce.
> > [...]
> > > From reading the kernel source, it may be possible to prevent swapping
> > > by placing MPlayer into a memory cgroup with memory.swappiness for the
> > > cgroup set to 0. I have not yet tried this.
> I have tried this, but it proved not to be sufficient.
> While putting a memory cap on the cgroup (e.g., 512MiB) and setting
> memory.swappiness=0 for the cgroup can prevent an MPlayer process placed
> there to induce swapping, sometimes the page cache contents are not
> attributed to MPlayer. When playing large video files (not DVDs) from
> an NTFS filesystem mounted via FUSE, page cache grew beyond the cgroup
> limits. When playing DVDs, sometimes page cache use of DVD data was
> limited by the cgroup memory controller, but once it was not (ejecting
> the DVD freed about 5GiB from the page cache, so it was DVD data).
> There is still the problem of other activity on the system beside
> MPlayer, thus limiting how MPlayer alone affects the page cache cannot
> always be sufficient.
> > > Many years ago, MPlayer developers looked into using something like
> > > madvise(2) to optimize MPlayer's memory usage, but at least back then
> > > it did not look promising.
> I was probably thinking of posix_fadvise(2).
> The situation may have changed since then, but I did not check
> With MPlayer providing a specialized caching layer (unless -nocache is
> used) it may seem sensible to try to minimize page cache impact when
> -cache is used. This could help in general, but would probably not
> suffice to reliably prevent the swap issue I have described.
> Before Ubuntu 18.04, I was using encrypted home directories instead of
> full disk encryption. Then I relied heavily on the page cache for
> decent performance, and playing a DVD totally trashed the page cache,
> but DVD playback worked without stuttering. The full disk encryption
> of Ubuntu 18.04 seems much more performant, because this general
> performance issue is gone.
> But I doubt that the results of MPlayer based page cache control can be
> significantly better than using a memory cgroup to constrain MPlayer.
> It would be more convenient, though.
> Additionally I tried using nocache (https://github.com/Feh/nocache),
> but that did not have any observable effect on DVD data in the page
> cache. It did not prevent swapping and the swapping related pauses.
More information about the MPlayer-users