From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 886 invoked from network); 7 Dec 1998 12:54:53 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 7 Dec 1998 12:54:53 -0000 Received: from helix.mdy.univie.ac.at (helix.mdy.univie.ac.at [131.130.40.7]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id HAA19060 for ; Mon, 7 Dec 1998 07:49:31 -0500 Received: from beta.mdy.univie.ac.at (stefan@beta.mdy.univie.ac.at [131.130.40.4]) by helix.mdy.univie.ac.at (8.8.8/8.8.8) with ESMTP id NAA12264 for ; Mon, 7 Dec 1998 13:49:26 +0100 (MET) From: Stefan Boresch Received: (from stefan@localhost) by beta.mdy.univie.ac.at (8.8.7/8.8.7) id NAA05322 for axp-list@redhat.com; Mon, 7 Dec 1998 13:49:25 +0100 Message-Id: <199812071249.NAA05322@beta.mdy.univie.ac.at> Subject: Swap/VM Question or "Cannot load interpreter" To: axp-list@redhat.com Date: Mon, 7 Dec 1998 13:49:25 +0100 (CET) Content-Type: text 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 #include #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); }; }; };