On Sun, 2011-01-16 at 14:41 -0800, Grant wrote:
> >> I've been running without swap for quite a while, but my system goes
> >> into a near freeze whenever I undertake a large emerge such as
> >> chromium or openoffice.  Is there anything I can do to prevent this
> >> besides turning swap back on?  I have 3GB RAM and MAKEOPTS="-j1".
> >>
> >> - Grant
> >>
> >>
> >
> > As Volker says, don't turn swap off. Make it small if you must, but
> > keep some around. It's just disk space.
> 
> I thought swap was no longer necessary on a machine with sufficient
> memory.  I guess I took I some bad advice a while back.

The answer is that you have insufficient memory when emerging - hence
swap is necessary - turn it on!  ionice will help, but it is alleviating
symptoms of lack of swap, not curing it.  Downside in this case is
slower emerges and some will still be flaky.

You can use a temporary swapfile or swap over ndb for those special
cases if you have no swap partition.  Also check the tunable
parameter /proc/sys/vm/swappiness to force memory to swap, or to get the
kernel to be very reluctant to use swap - can give the benefits of no
swap, but still have a safety margin with a small penalty when running
low on memory.  google for "/proc/sys/vm/swappiness"

In short, swap is good, downside to swap is sometimes small pauses while
pages are swapped back in.  But not having swap forces the kernel to
have a large overhead in trying to manage a low memory situation when it
gets low such as during an emerge.  No swap is ok if you have a system
doing almost nothing, but with almost any normal use, 3G and no swap is
going to be trouble at times.

BillK




Reply via email to