Gentoo Archives: gentoo-amd64

From: Enrico Weigelt <weigelt@×××××.de>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Re: Memory usage; 32 bit vs 64 bit.
Date: Thu, 06 Jan 2011 21:05:52
Message-Id: 20110106202920.GA13292@nibiru.local
In Reply to: [gentoo-amd64] Re: Memory usage; 32 bit vs 64 bit. by Duncan <>
* Duncan <1i5t5.duncan@×××.net> wrote:

> $free -m > total used free shared buffers cached > Mem: 5925 3334 2590 0 319 1571 > -/+ buffers/cache: 1443 4481 > Swap: 20479 0 20479
Apropos total memory: on my box w/ 4GB, it only shows up 3GB. On bootup, kernel (built w/ CONFIG_HIGHMEM4G=y) says: 2119MB HIGHMEM available. 887MB LOWMEM available. Who's eating up a whole GB ? BIOS ? GPU ?
> Tho in my experience, even the 1.4 gigs of app usage isn't entirely > required. It has been awhile ago now, but at one point I was running 1 > gig of total RAM, with no swap. At that time, app-memory usage seemed to > run ~ half a gig. When I upgraded RAM to 8 gigs (I since lost a stick > that I've not replaced, thus the current 6 gigs), app memory usage > increased as well, to closer to a gig (IIRC it was about 1.2 gig after a > week's uptime, back then, to compare apples to apples as they say), > without changing what I was running or the settings.
That's interesting. Which of the apps now use more memory ? Any database systems on your box ?
> Individual app memory usage on Linux is unfortunately a rather complex > subject. Top is a useful app for reporting on and controlling (nicing, > killing, etc) other apps. Top's manpage has a nice description of the > various memory related stats and how they relate to each other, so I'll > refer you to that for some detail I'm omitting here. Meanwhile, on non- > swapping systems, resident memory (top's RES column) is about as accurate > a first-order approximation of app memory usage as you'll get, but it's > only reporting physical memory, so won't include anything swapped out. > Also, the memory one could expect to free by terminating that app will be > somewhat less than resident memory, due to libraries and data that may be > shared between multiple apps. Top has a SHR (shared) column to report > potentially shared memory, but doesn't tell you how many other apps (maybe > none) are actually sharing it. Some memory reporting apps won't count > shared memory as belonging to the app at all, others (like top, AFAIK) > report the full memory shared as belonging to each app, while still others > try to count how many apps are sharing what bits, and divide the shared > memory by the number of apps sharing it. Which way is "right" depends on > what information you're actually looking for. If you want the app totals > to match actual total memory usage, apportioned share reporting is the way > to go. If you want to know what quitting the app will actually free, only > count what's not shared by anything else. If you want to know how much > memory an app is actually using, regardless of other apps that may be > sharing it too, count all the memory it's using, shared or not.
Yep, depending on the actual question you ask, you'll have to look at different stats. For example, if you're interested in how much memory usage a single process adds to the system (IOW: how much would be freed by killing it), you'll have to look through all its mappings and count off the pages that are also mapped by other process'es. BTW: does anyone know a tool for that (just too lazy to code it by myself right now ;-o)
> Then there's swapping. Due to the way Linux works, the data available on > swapped out memory is limited. To get all the normal data would require > swapping all that data back in, rather defeating the purpose of swap, so > few if any memory usage reporting utils give you much detail about > anything that's swapped out. For people with memory enough to do so, a > swapoff (or simply running without swap at all) force-disables swap, thus > making full statistics available, but as mentioned above, to a point, many > apps will use more memory if it's available, conserve if it's not, so > running without swap on systems that routinely report non-zero swap usage > doesn't necessarily give a true picture of an app's memory usage with swap > enabled, either.
BTW: does anyone know a sane way how to hand-off this to the kernel ? So eg. a RDBMS could ask the kernel how much buffers it should use ? (or somehow use the kernel's buffercache decisions) cu -- ---------------------------------------------------------------------- Enrico Weigelt, metux IT service -- phone: +49 36207 519931 email: weigelt@×××××.de mobile: +49 151 27565287 icq: 210169427 skype: nekrad666 ---------------------------------------------------------------------- Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme ----------------------------------------------------------------------


Subject Author
Re: [gentoo-amd64] Re: Memory usage; 32 bit vs 64 bit. Volker Armin Hemmann <volkerarmin@××××××××××.com>
Re: [gentoo-amd64] Re: Memory usage; 32 bit vs 64 bit. Mark Knecht <markknecht@×××××.com>