Re: Break 2.4 VM in five easy steps

Eric W. Biederman (ebiederm@xmission.com)
07 Jun 2001 00:35:36 -0600


LA Walsh <law@sgi.com> writes:

> "Eric W. Biederman" wrote:
>
> > The hard rule will always be that to cover all pathological cases swap
> > must be greater than RAM. Because in the worse case all RAM will be
> > in thes swap cache. That this is more than just the worse case in 2.4
> > is problematic. I.e. In the worst case:
> > Virtual Memory = RAM + (swap - RAM).
>
> Hmmm....so my 512M laptop only really has 256M? Um...I regularlly run
> more than 256M of programs. I don't want it to swap -- its a special, weird
> condition if I do start swapping. I don't want to waste 1G of HD (5%) for
> something I never want to use. IRIX runs just fine with swap<RAM. In
> Irix, your Virtual Memory = RAM + swap. Seems like the Linux kernel requires
> more swap than other old OS's (SunOS3 (virtual mem = min(mem,swap)).
> I *thought* I remember that restriction being lifted in SunOS4 when they
> upgraded the VM. Even though I worked there for 6 years, that was
> 6 years ago...

There are cetain scenario's where you can't avoid virtual mem =
min(RAM,swap). Which is what I was trying to say, (bad formula). What
happens is that pages get referenced evenly enough and quickly enough
that you simply cannot reuse the on disk pages. Basically in the
worst case all of RAM is pretty much in flight doing I/O. This is
true of all paging systems.

However just because in the worst case virtual mem = min(RAM,swap), is
no reason other cases should use that much swap. If you are doing a
lot of swapping it is more efficient to plan on mem = min(RAM,swap) as
well, because frequently you can save on I/O operations by simply
reusing the existing swap page.

>
> > You can't improve the worst case. We can improve the worst case that
> > many people are facing.
>
> ---
> Other OS's don't have this pathological 'worst case' scenario. Even
> my Windows [vm]box seems to operate fine with swap<MEM. On IRIX,
> virtual space closely approximates physical + disk memory.

It's a theoretical worst case and they all have it. In practice it is
very hard to find a work load where practically every page in the
system is close to the I/O point howerver.

Except for removing pages that aren't used paging with swap < RAM is
not useful. Simply removing pages that aren't in active use but might
possibly be used someday is a common case, so it is worth supporting.

>
> > It's worth complaining about. It is also worth digging into and find
> > out what the real problem is. I have a hunch that this hole
> > conversation on swap sizes being irritating is hiding the real
> > problem.
>
> ---
> Okay, admission of ignorance. When we speak of "swap space",
> is this term inclusive of both demand paging space and
> swap-out-entire-programs space or one or another?

Linux has no method to swap out an entire program so when I speak of
swapping I'm actually thinking paging.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/