tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: where is my memory?



On Wed, Sep 22, 2010 at 10:57 AM, matthew sporleder
<msporleder%gmail.com@localhost> wrote:
> On Wed, Sep 22, 2010 at 9:18 AM, Johnny Billquist <bqt%softjar.se@localhost> 
> wrote:
>> der Mouse wrote:
>>>>>>
>>>>>> total memory = 2047 MB
>>>>>> avail memory = 1999 MB
>>>>>
>>>>> total memory = 256 MB
>>>>> avail memory = 239 MB
>>>>
>>>> Some graphics chips, especially on lower-end machines, use main
>>>> memory, thus making it unavailable to the CPU.
>>>
>>> It's not that simple.  I've seen this for a very long time, including
>>> on machines with no graphics chips at all, such as 4.3 on a VAX 750.
>>> Here's a live example; this is quoted from /var/run/dmesg.boot on a
>>> SPARCstation LX that's my desktop at one of my workplaces:
>>>
>>> total memory = 48688 KB
>>> avail memory = 41676 KB
>>>
>>> That's with a cg6 with its own private framebuffer RAM.
>>
>> Well, for VAXen, the difference between total memory, and available
>> memory is:
>>
>>
>> ***snip***
>>
>>        format_bytes(pbuf, sizeof(pbuf), avail_end);
>>        printf("total memory = %s\n", pbuf);
>>        panicstr = NULL;
>>        mtpr(AST_NO, PR_ASTLVL);
>>        spl0();
>>
>> #if VAX46 || VAX48 || VAX49 || VAX53 || VAXANY
>>        minaddr = 0;
>>
>>        /*
>>         * Allocate a submap for physio.  This map effectively limits the
>>         * number of processes doing physio at any one time.
>>         */
>>        phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
>>                                   VM_PHYS_SIZE, 0, false, NULL);
>> #endif
>>
>>        format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
>>        printf("avail memory = %s\n", pbuf);
>>
>> ***snip***
>>
>> So, obviously a malloc for physio... :-)
>>
>> Don't know about any other ports, but the code is there for the
>> inspection...
>>
>
>
> So in x86 land this is the *_init() functions from
> src/sys/kern/init_main.c?  Is it just the functions that come before
> uvm_init()?
>

This is, at least, where some of the avail and total numbers come
from.  I added a custom kernel to watch the memory during the boot and
got this:
total memory = 255MB

avail memory = 238 MB  <- after consinit
avail memory = 237 MB  <- after uvm_init
avail memory = 235 MB  <- after a bunch of devices startup
avail memory = 234 MB  <- final number

Does vmstat -m mention any of this stuff?

Matt


Home | Main Index | Thread Index | Old Index