[mythtv-users] how to make 0.24 more like 0.21 ?

Mark Lord mythtv at rtr.ca
Wed Oct 26 20:15:00 UTC 2011


On 11-10-26 03:32 PM, Roger Horner wrote:
..
> Already done.  Small boot drive has OS and SQL (plus some space for MythVideo
> data).  Large secondary drive has all my recordings.  I haven't really been
> having any "disk problems" per say with the new systems, just curiuous that it
> would need to use swap at all.
..

Linux manages memory based on pages (4KB), and treats system RAM
as a huge cache for pages from disk.  Some memory doesn't originate
from disk (think.. "malloc"), and this memory is called "anonymous"
because there is no disk filename associated with it.

Normally, Linux will just page new things in as they are referenced
(code, data, whatever), and keep them around afterward even when no
longer referenced by any processes.

When RAM gets low, Linux will free up RAM by discarding unmodified pages,
since it knows it can recreate their contents by re-reading them from
their original files if need be.

But for modified (non-zero) "anonymous" pages, there are no original files.
So these have to be kept in RAM forever, or until the processes
that allocated them terminate.

If a process allocates too much anonymous memory, the system can run
out of discardable pages, and the kernel may eventually panic, or may
run the "out of memory killer" to arbitrarily nuke/kill memory hogs.

To prevent this on systems with insufficient RAM, one can enable SWAP space.
SWAP is used as "the file" for paging out anonymous pages.

There are algorithms in the kernel which decide when to page out and discard
anonymous stuff versus discarding active program pages to reclaim RAM,
and a balance has to be struck somewhere.

So.. if your system has sufficient RAM (say 2GB for a mythtv FE/BE),
and you don't want it do use SWAP, then simply don't mount any SWAP space.
The kernel will do more discarding of process pages than without SWAP,
but only when under high RAM pressure (rare).  But everything will keep
running and working just fine, so long as there are no major memory leaks.

Cheers


More information about the mythtv-users mailing list