Re: Memory usage

From: Jan Niehusmann (list005@gondor.com)
Date: Tue Mar 28 2000 - 05:58:58 EST


On Mon, Mar 27, 2000 at 11:43:49PM -0800, David Raufeisen wrote:
> total used free shared buffers cached
> Mem: 255224 244016 11208 0 2804 187508
> -/+ buffers/cache: 53704 201520
> Swap: 126752 56712 70040
>
> does that swap usage seem odd to anyone else considering the 'ps aux' output
> below?
>
> btw this is kernel 2.3.99pre3

I have a similar problem: (Kernel 2.3.99pre3, 256MB Ram)

(this bug report may be considered useless because the kernel is
compiled with gcc 2.95.3 19991030 (prerelease) from gcc-2.95.2-4mdk)

# free
             total used free shared buffers cached
Mem: 255180 155116 100064 0 2860 68320
-/+ buffers/cache: 83936 171244
Swap: 104416 0 104416

# time dd if=/dev/zero of=/dev/sdb2 bs=1024k count=100
0.00user 7.24system 8:46.42elapsed 1%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (118major+18minor)pagefaults 0swaps

# free
             total used free shared buffers cached
Mem: 255180 249824 5356 0 104800 51544
-/+ buffers/cache: 93480 161700
Swap: 104416 1920 102496

 procs memory swap io system cpu
 r b w swpd free buff cache si so bi bo in cs us sy id
 0 0 0 0 100152 2860 68320 0 0 0 0 102 523 0 2 98
 0 0 0 0 100152 2860 68320 0 0 0 0 102 512 0 2 98
 1 0 1 0 17396 76572 68332 0 0 13 13104 175 476 10 186 41698615
 1 0 1 0 9120 83900 68332 0 0 0 3904 162 430 2 22 76
 0 1 1 0 4856 87676 68332 0 0 0 3776 162 428 2 12 86
 0 1 2 644 2408 91896 67580 0 644 0 4001 182 492 4 25 71
 0 1 1 1408 7540 95512 59684 0 764 0 4031 186 410 2 18 80
 0 1 1 1408 3208 99340 59684 0 0 0 3904 163 427 2 16 82
 0 1 1 1920 7772 103288 51296 0 512 0 3968 177 457 2 17 81
 0 1 1 1920 6080 104784 51296 0 0 0 1889 162 425 0 8 92
 0 1 1 1920 6080 104784 51296 0 0 0 61 163 410 2 0 98
 0 1 1 1920 6080 104784 51296 0 0 0 60 162 443 2 0 98
 1 0 1 1920 6080 104784 51296 0 0 0 222 198 480 0 2 98
 1 0 1 1920 6080 104784 51296 0 0 0 182 222 539 2 0 98
 0 1 1 1920 6080 104784 51296 0 0 0 243 220 522 0 6 94
 0 1 1 1920 6080 104784 51296 0 0 0 183 220 538 2 0 98
 1 0 1 1920 6080 104784 51296 0 0 0 118 221 513 2 0 98

As you can see, the write starts relatively fast (ca 4000 blocks per second,
this is not a very fast scsi disk, but ok). After 3 seconds the system
starts to swap out. Not much (I wrote only 100MB and I had 100MB of free
memory), but while doing the same with 500MB I saw swap usages of 100MB.

Then dd writes out it's "100+0 records in/100+0 records out" message, but
doesn't return. Instead the write rate goes down to 120 blocks per second,
and stays there for a very long time. The same happens if I do a "sync"
during a big write: The write speed drops to less than 10% of its normal
value. If I do nothing else, vmstat displays:

 procs memory swap io system cpu
 r b w swpd free buff cache si so bi bo in cs us sy id
 0 1 1 1920 5308 104788 51448 0 0 0 121 223 716 2 0 98
 0 1 1 1920 5308 104788 51448 0 0 0 120 222 746 2 2 96
 0 1 1 1920 5308 104788 51448 0 0 0 120 222 746 0 2 98
 0 1 1 1920 5308 104788 51448 0 0 0 121 223 718 0 2 98
 0 1 1 1920 5308 104788 51448 0 0 0 120 222 725 2 2 96

That is, 120 writes per second, and 100(timer)+120 interrupts per second.
So, the system seems to write only one block per interrupt, something is
wrong here, isn't it? After all, this was a sequential write directly to
the device. (The same happens if I write to regular file on the scsi disk).

Writing to ide is much better, but that may be caused by the fact that my
ide drive is much faster.

Without knowing the internals, I think linux is filling up it's whole
memory with dirty buffers (and even starts to swap - this may get fatal
if the swap partition is on the same drive as the file written to) and
then has a problem writing the stuff back.

Jan

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:21 EST