Re: What are the first 2 columns in "top"'s memory report for really? Man page doesn't say!

2015-12-21 Thread Otto Moerbeek
On Tue, Dec 22, 2015 at 02:31:58AM +0800, Tinker wrote:

> Hi, on my 4GB RAM machine, top says
> 
> "Memory: Real: 1293M/3786M act/tot Free: 158M Cache: 2079M Swap: 449M/10G"
> 
> All the five first columns vary over time, in particular the first four.
> 
> 3786 + 158 = 3944 is fairly close to 4GB so I guess that's the amount of RAM
> that the BIOS (+HW drivers?) actually left usable, so that number makes
> sense.

AFAIK:

tot: memory allocated by kernel
act: memory recently accessed, subset of tot.
free: memory not allocated
tot + free: total memory available
cache: pages allocated to buffer (filesystem) cache

all memory includes both kernel and memory used by processes.

-Otto


> 
> The 158 number is fairly clear also - that's all the RAM that's not in use.
> 
> And the 2079 number should be the total amount of filesystem cache.
> 
> But then what are the first two numbers, and there in particular the second
> one??
> 
> I guess the first one is the total amount of malloc():s (I guess including
> the actual malloc structures).
> 
> But the second one makes no sense - 1293 (first column) + 2079 (fourth
> column) make 3372 so this number does not only cover malloc:s and the FS
> cache then, but there are 414MB of other stuff. Is it that the kernel with
> all of its work takes 414MB?? If so that's weird because really the machine
> doesn't do a lot.
> 
> The "man" page doesn't say any of this.
> 
> I think it's good to know this, for diagnostic purposes.
> 
> Anyone knows what the second column is for?
> 
> Thanks,
> Tinker



Re: What are the first 2 columns in "top"'s memory report for really? Man page doesn't say!

2015-12-21 Thread Tinker

On 2015-12-22 03:32, Otto Moerbeek wrote:

On Tue, Dec 22, 2015 at 02:31:58AM +0800, Tinker wrote:


Hi, on my 4GB RAM machine, top says

"Memory: Real: 1293M/3786M act/tot Free: 158M Cache: 2079M Swap: 
449M/10G"


All the five first columns vary over time, in particular the first 
four.


3786 + 158 = 3944 is fairly close to 4GB so I guess that's the amount 
of RAM
that the BIOS (+HW drivers?) actually left usable, so that number 
makes

sense.


AFAIK:

tot: memory allocated by kernel
act: memory recently accessed, subset of tot.
free: memory not allocated
tot + free: total memory available
cache: pages allocated to buffer (filesystem) cache

all memory includes both kernel and memory used by processes.


Interesting.

Okay so mallocs could be a huge part of the "tot" then.

Do you have any idea of the definition of "active" here?

(As in what makes a given part of "tot" be declared "active" by the OS.)

Also what special treatment may the OS give memory that is not "active", 
swap it to disk??




Re: What are the first 2 columns in "top"'s memory report for really? Man page doesn't say!

2015-12-21 Thread Otto Moerbeek
On Tue, Dec 22, 2015 at 04:04:55AM +0800, Tinker wrote:

> On 2015-12-22 03:32, Otto Moerbeek wrote:
> >On Tue, Dec 22, 2015 at 02:31:58AM +0800, Tinker wrote:
> >
> >>Hi, on my 4GB RAM machine, top says
> >>
> >>"Memory: Real: 1293M/3786M act/tot Free: 158M Cache: 2079M Swap:
> >>449M/10G"
> >>
> >>All the five first columns vary over time, in particular the first four.
> >>
> >>3786 + 158 = 3944 is fairly close to 4GB so I guess that's the amount of
> >>RAM
> >>that the BIOS (+HW drivers?) actually left usable, so that number makes
> >>sense.
> >
> >AFAIK:
> >
> >tot: memory allocated by kernel
> >act: memory recently accessed, subset of tot.
> >free: memory not allocated
> >tot + free: total memory available
> >cache: pages allocated to buffer (filesystem) cache
> >
> >all memory includes both kernel and memory used by processes.
> 
> Interesting.
> 
> Okay so mallocs could be a huge part of the "tot" then.
> 
> Do you have any idea of the definition of "active" here?
> 
> (As in what makes a given part of "tot" be declared "active" by the OS.)
> 
> Also what special treatment may the OS give memory that is not "active",
> swap it to disk??
> 

Don't know the details how/when pages are marked inactive, but the
general ideas is: inactive r/o pages may be reclaimed when pages are
needed, inactive (and dirty) r/w pages may be written to disk (for
buffers) or swap (other r/w pages) when pages are needed for other
things. 

-Otto