[MPlayer-users] DVD playback issue on older notebook with not so old Linux kernel

Alexander Strasser eclipse7 at gmx.net
Sun May 17 14:07:27 EEST 2020


Hi Erik!

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 ?


Thanks for sharing your insights on a DVD playback issue.


Best regards,
  Alexander


> Since upgrading an older notebook (with HDD, no SSD) from Ubuntu 16.04 LTS
> to Ubuntu 18.04 LTS, I could no longer play a complete DVD with MPlayer
> without "hanging" playback.  The picture would freeze for a short,
> but noticable time, at random moments.
>
> This issue can be prevented by disabling swap:
>
>     sudo swapoff -a
>
> I would do that for a dedicated media player PC, but I'd rather avoid
> this for a general purpose notebook system.  I disable swap just before
> playing a DVD now.
>
> The problem lies in the use of swap at all, which impacts the system
> heavily, instead of freeing pages from the page cache, which does not
> impact the system at all for the streaming workload of DVD playback.
>
> Adjusting the "vm.swappiness" value does not help, swap is still
> preferred over freeing page cache pages, even with vm.swappiness=0.
> A quick glance at the current Linux kernel code suggests that the meaning
> of this value has changed dramatically through the years.  Currently,
> it is only checked for equality with zero.
>
> Clearing the page cache before DVD playback does not suffice on the
> above mentioned notebook, because it does not have sufficient RAM for
> all of the DVD, MPlayer, and a desktop environment.
>
> The issues could probably be prevented by upgrading the hardware:
>
>   1. Having sufficient RAM to hold all of the DVD in the page cache,
>      as well as all the software used during DVD playback (MPlayer,
>      desktop environment, ...).  16GiB should suffice for DVD playback.
>      This is not possible for the old notebook mentioned above.
>
>   2. Replacing the HDD by an SSD might work as well.
>
> A 2016 LWN article, "Reconsidering swapping", describes how back then the
> Linux memory subsystem was overhauled to make better use of swap on SSD.
> While this was supposed to not significantly impact HDD users, since it
> relies on using swap before deciding on how much to use it, where before
> swap was not used unless really necessary, this does affect HDD users.
>
> The basic idea can be gleaned from
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1160330.html:
>
>     "However, when recycling page cache incurs a higher cost in IO than
>      swapping out a few unused anonymous pages would, it makes sense to
>      increase swap pressure."
>
> The streaming IO workload of DVD playback adds all of the movie data to
> the page cache.  This results in filling the RAM, and now RAM contents
> can be written to disk, i.e., swapped out, instead of just dropping
> older page cache entries.
>
> 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.
>
> 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.  Thus MPlayer relies on the kernel providing
> useful default behaviour.  It would still rely on the kernel providing
> useful specific behaviour, which was deemed not the case back when.
> This may have changed for the better, but this is far from certain.


More information about the MPlayer-users mailing list