Re: Overcommitable memory??

From: Rask Ingemann Lambertsen (rask-linux@kampsax.k-net.dk)
Date: Sun Mar 19 2000 - 10:45:16 EST


Den 17-Mar-00 20:07:56 skrev Olaf Weber fĝlgende om "Re: Overcommitable memory??":

> One thing that irks me about the current discussion is the complete
> lack of data: I would be interesting to know how much additional VM a
> sane non-overcommitting regime requires when compared with the
> overcommitting case? It seems no-one actually knows.

   That rarely keeps people from coming up with completely wild numbers to
help their argumentation, though.

   Quite a while ago I wrote an awk script "memstat" to figure this out,
based on /proc:

echo /proc/[0-9]* | tr ' ' '\n' | awk 'BEGIN { } \
                          { \
                              statfile = $0 "/stat"; \
                              statmfile = $0 "/statm"; \
                              getline stat <statfile; \
                              getline statm <statmfile; \
                              close (statfile); \
                              close (statmfile);
                              split (stat, memstat); \
                              virtuel += memstat[23] / 4096; \
                              resident += memstat[24]; \
                              split (statm, memstatm); \
                              shared += memstatm[3]; \
                          } \
                          END { \
                            fysisk = resident - shared; \
                            swap = virtuel - resident; \
                            printf "Fysisk hukommelse (ikke delt): %9d kB (%6d MB)\n", fysisk * 4, fysisk / 256; \
                            printf "Virtuel hukommelse (ikke delt): %9d kB (%6d MB)\n", swap * 4, swap / 256; \
                            printf "Delt hukommelse (fys + vir): %9d kB (%6d MB)\n", shared * 4, shared / 256; \
                            printf "Forbrugt adresserum totalt: %9d kB (%6d MB)\n", virtuel * 4, virtuel / 256; \
                          }'

   The script prints (in danish) the amount of non-shared RAM used, the
amount of non-shared swap used, the amount shared RAM+swap used and the
total address space used. The following output is from the dorm server
where people have shell access and a 100 MB quota:

shell prompt> memstat; free
Fysisk hukommelse (ikke delt): 16836 kB ( 16 MB)
Virtuel hukommelse (ikke delt): 147020 kB ( 143 MB)
Delt hukommelse (fys + vir): 37492 kB ( 36 MB)
Forbrugt adresserum totalt: 201348 kB ( 196 MB)
             total used free shared buffers cached
Mem: 128216 119240 8976 36716 39132 45524
-/+ buffers/cache: 34584 93632
Swap: 130748 21508 109240

   What we see is that of the 196 MB of total address space used, 21 MB is
swapped out, 34 MB is in RAM and an unknown amount is code (or mmap()ed
files) which is demand loaded/unloaded from other backing store. The 196 MB
also includes the 36 MB of shared areas which have been counted too many
times. So a pessimistic estimate is a factor of (196 MB - 36 MB) / (21 MB +
34 MB) = 2.9. This is a far cry from the doomesday predictions some people
have come up with. Still, we'll happily add more swapspace if needed - a 4
GB ATA disk costs very little these days and generally, disk space is cheap
compared to lost work, frustration, instability reputations, downtime, etc.

Regards,

/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻTŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Rask Ingemann Lambertsen | E-mail: mailto:rask@kampsax.dtu.dk |
| Please do NOT Cc: to me or the | WWW: http://www.gbar.dtu.dk/~c948374/ |
| mailing list. I am on the list.| "ThrustMe" on XPilot, ARCnet and IRC |
| Packet radio - a true Ether net |

-
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 : Thu Mar 23 2000 - 21:00:28 EST