public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Can't make use of swap memory in 2.6.7-bk19
@ 2004-07-08  1:36 Peter Osterlund
  2004-07-08  1:43 ` William Lee Irwin III
  2004-07-08  2:14 ` Nick Piggin
  0 siblings, 2 replies; 24+ messages in thread
From: Peter Osterlund @ 2004-07-08  1:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton

I created a test program that allocates a 300MB buffer and writes to
all bytes sequentially. On my computer, which has 256MB RAM and 512MB
swap, the program gets OOM killed after dirtying about 140-180MB, and
the kernel reports:

Out of Memory: Killed process 3421 (memalloc2).

I ran "vmstat 1" during the test:

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0  89844 130624    676  22036  107  296   635   329 1214   452  4  3 63 30
 0  0  89844 130608    692  22036    0    0     0    72 1164   504  3  1 96  0
 0  0  89844 130608    692  22036    0    0     0     0 1067   256  0  0 100  0
 0  0  89844 130608    692  22036    0    0     0     0 1066   248  0  0 100  0
 2  1  99864   2576     80  10016    0    0     8     0 1065  1052 42 41 15  2
[~10s delay here, then all lines below are displayed very quickly]
 0 12 249332   2216    108   5304  164 19440  5280 19440 3572   846  1 24  0 75
 0 11 249332   1992    124   7028  152  372  2620   372 1167   221  0  2  0 98
 0 16  95972 145548    196   8668  216  508  1908   540 1165   248  0  3  0 97
 0 12  95972 143160    228  11124  120    0  2616     0 1184   249  0  1  0 99
 0  8  95972 141040    240  13136  208    0  2236     0 1167   263  0  1  0 99
 0  4  95972 139448    248  14464  252    0  1588     0 1168   248  1  2  0 97
 0  0  95924 138412    260  15400  184    0  1080     8 1187   259  2  0 11 87

"free" directly afterwards:

             total       used       free     shared    buffers     cached
Mem:        255460     119304     136156          0        332      17892
-/+ buffers/cache:     101080     154380
Swap:       530136      89916     440220

I tried setting swappiness to 0, 50, 100, tried changing
overcommit_memory, added an extra 300MB swap file, but I was still not
able to make the test program succeed.

I see this problem using 2.6.7-bk19. I haven't tried other 2.6
kernels, but 2.4.27-rc2 doesn't show the problem.

Here is the test program:

#include <stdio.h>
#include <stdlib.h>

#define MB (1024 * 1024)
#define SIZE (300 * MB)

int main()
{
    int i;
    char *ptr;

    ptr = malloc(SIZE);
    for (i = 0; i < SIZE; i++) {
	ptr[i] = i;
	if ((i % MB) == 0)
	    printf("%d\n", i / MB);
    }
    return 0;
}

-- 
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2004-07-14 20:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-08  1:36 Can't make use of swap memory in 2.6.7-bk19 Peter Osterlund
2004-07-08  1:43 ` William Lee Irwin III
2004-07-08  2:14 ` Nick Piggin
2004-07-08  2:30   ` William Lee Irwin III
2004-07-08 12:59     ` Peter Osterlund
2004-07-08 19:39       ` William Lee Irwin III
2004-07-09  0:57         ` Nick Piggin
2004-07-09  1:53           ` William Lee Irwin III
2004-07-09  2:06             ` Nick Piggin
2004-07-09  2:09               ` William Lee Irwin III
2004-07-09  2:12                 ` Andrew Morton
2004-07-09  2:50                   ` William Lee Irwin III
2004-07-09  4:51                     ` Andrew Morton
2004-07-09  2:14                 ` Nick Piggin
2004-07-08  8:12   ` Peter Osterlund
2004-07-08  8:20     ` Andrew Morton
2004-07-08  8:23       ` Nick Piggin
2004-07-08  9:30         ` Peter Osterlund
2004-07-14  5:20           ` William Lee Irwin III
2004-07-14 10:39             ` Peter Osterlund
2004-07-14 10:57               ` William Lee Irwin III
2004-07-14 12:55                 ` Peter Osterlund
2004-07-14 13:22                   ` William Lee Irwin III
2004-07-14 20:00                     ` Peter Osterlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox