* Swap/VM Question or "Cannot load interpreter"
@ 1998-12-07 12:49 Stefan Boresch
1998-12-07 15:01 ` Greg Lindahl
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Boresch @ 1998-12-07 12:49 UTC (permalink / raw)
To: axp-list
This is a follow-up to my questions from a few days ago. I seem to
have solved my problem, but I would really like to understand why
things work the way they (apparently) do.
It turns out that the instabilities (manifesting themselves with
'Cannot load interpreter' messages) go away when I add plenty of swap
space, much more than I naively thought to be required.
The machine in question is a LX-533MHz with 256MB RAM and (originally)
272 MB swap space (two partitions). My (actually D. Gilbert's )
testprogram (I'll append it one more time at the end of this mail)
allocates memory for a large array, then writes and read to it in an
infinite loop. When I set the array size to 240MB, the whole job
still fits nicely in RAM, no swap space is used. Well, obviously when
I set the array size to 260 MB, the machine has to swap. Assuming
that the kernel and the various demons eat several MBs, I estimated
that the job would use maybe 20-30MB swapspace. Well, so it does,
initially. However, watching with vmstat (thanks for pointing out
this utility), the actual used swap space climbs all the way up to
272M. It seems that in the course of one read/write cycle the whole
260M array is swapped to disk. Now the job usually runs for several
iterations, but apparently at some point there is memory starvation
and the "Cannot load interpreter" messages appear. I guess I can
understand that it may be faster to have everything that is in memory
also in the swap space, but should it crash the machine? Do my
findings imply that any useable swap space has to be at least the size
of RAM (plus, possibly, some extra MBs)? Is this the origin of the
rule of the thumb that swap space ought to be at least twice the size
of RAM? (E.g., the one UX on which this test runs fine incidentally
has 128MB of RAM and 256MB of swap, obviously the test was run only
with 130MB) For this particular testcase on the LX, adding a swapfile
of 96MB cured the problem (bringing total swap to 272+96=368MB).
Behavior of a 2.0.35 and 2.0.36 kernel was identical. Increasing
the values in /proc/sys/vm/freepages helped stall the problem, but
eventually it would show up; only the larger swap space fixed the
problem.
Again, I'd appreciate to understand how this works to avoid set-up
problems/mistakes for future machines. Maybe, on the other hand, my
experience helps explain why other people see this message under heavy
swapping.
Thanks,
Stefan Boresch
-----------------------------------------------------------------------
Our adapted version of D. Gilbert's memtest.c (using egcs 1.1b)
#include <stdio.h>
#include <stdlib.h>
#define SIZE (260*256*1024*sizeof(int))
int main() {
volatile int * volatile pl=(int *)malloc(SIZE);
int a;
int s;
int sum1,sum2;
printf("Using %d bytes.\n",SIZE);
for(s=1056;;s++) {
printf("Filling with seed of s=0x%x \n",s);
srandom(s);
sum1=0;
for(a=0;a<(SIZE/sizeof(int));a++) {
int tmp1=random();
sum1+=tmp1;
pl[a]=tmp1;
};
srandom(s);
printf("Testing with seed of s=0x%x \n",s);
for(a=0,sum2=0;a<(SIZE/sizeof(int));a++) {
int tmp1=random();
int tmp2=pl[a];
sum2+=tmp1;
if (tmp1!=tmp2) {
fprintf(stderr,"MISMATCH ERROR! at a=0x%x (random=0x%x array=0x%x
reread=0x%x seed=
0x%x)\n",a,tmp1,tmp2,pl[a],s);
};
};
printf("Completed pass with seed of s=0x%x sum1=0x%x
sum2=0x%x\n",s,sum1,sum2);
if (sum1!=sum2) {
printf("Internal inconsistency! Sums differ! sum1=0x%x
sum2=0x%x\n",sum1,sum2);
exit(2);
};
};
};
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Swap/VM Question or "Cannot load interpreter"
1998-12-07 12:49 Swap/VM Question or "Cannot load interpreter" Stefan Boresch
@ 1998-12-07 15:01 ` Greg Lindahl
1998-12-08 11:57 ` Mark Conway Wirt
0 siblings, 1 reply; 3+ messages in thread
From: Greg Lindahl @ 1998-12-07 15:01 UTC (permalink / raw)
To: axp-list
> Is this the origin of the
> rule of the thumb that swap space ought to be at least twice the size
> of RAM?
No. On other Unix versions, all pages must have a disk page for every
memory page. This isn't true for Linux. The behavior you describe is a
bug. It's not a bug that your swap gets used -- the kernel is just
trying to keep the free list big by speculatively writing out dirty
data pages to disk. But then that there is resource exhaustion is a
bug. However, the symptom you see may still not help identify the
problem.
-- g
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Swap/VM Question or "Cannot load interpreter"
1998-12-07 15:01 ` Greg Lindahl
@ 1998-12-08 11:57 ` Mark Conway Wirt
0 siblings, 0 replies; 3+ messages in thread
From: Mark Conway Wirt @ 1998-12-08 11:57 UTC (permalink / raw)
To: axp-list
On Mon, Dec 07, 1998 at 10:01:47AM -0500, Greg Lindahl wrote:
> > Is this the origin of the
> > rule of the thumb that swap space ought to be at least twice the size
> > of RAM?
>
> No. On other Unix versions, all pages must have a disk page for every
> memory page. This isn't true for Linux. The behavior you describe is a
> bug. It's not a bug that your swap gets used -- the kernel is just
> trying to keep the free list big by speculatively writing out dirty
> data pages to disk. But then that there is resource exhaustion is a
> bug. However, the symptom you see may still not help identify the
> problem.
Also, if it's a bug (and I think it is), it's not only the Alpha kernel:
I saw the same behaviour on a pentium running 2.0.34 the other day....
--Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-12-08 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-07 12:49 Swap/VM Question or "Cannot load interpreter" Stefan Boresch
1998-12-07 15:01 ` Greg Lindahl
1998-12-08 11:57 ` Mark Conway Wirt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox