On 5/10/15 13:08 , Lloyd Parkes wrote:
> 
>> On 9/05/2015, at 5:30 pm, Robert Mustacchi <[email protected]> wrote:
>> However, whenever memory is allocated
>> either through the use of the brk system call or through the use of
>> mmap, we ensure that we always have a swap reservation for it,
>> regardless if we are using it or not.
>>
>> ...
>>
>> Let me know if this makes sense or if I can explain it better.
> 
> Yeah, I’ll ask.
> 
> What do you mean by swap? Several years ago I seem to recall Sun/Oracle 
> announced that RAM now counted as swap for some reason. This messes with my 
> head because swapping to physical memory is crazy talk. (Note that I have 
> used some system that had DRAM that wasn’t directly addressable by the CPU 
> and so that counted as secondary storage implemented with DRAM rather than 
> physical memory).
> 
> When Solaris derived systems talk about swap reservations is that actually 
> _exactly_ the opposite of the virtual memory overcommit that occasionally 
> troubles Linux systems and so swap reservation is really a virtual memory 
> reservation?

This is a bit of a confusing topic. So apologies about that, the use of
terminology here is a bit inconsistent in the system and we need to find
some better ones that are a little less confusing. I'll start from the top.

On illumos systems, when memory is allocated (mmap, brk, etc.), we
always make sure we have a swap reservation. What we want to ensure is
that if you use this memory and it needs to be paged out, it always has
some place to go. If it's a memory map backed by a file, we use that. If
it's anonymous memory, eg. mmap of /dev/zero, then we'll do something
different.

This is where the thing you mentioned about using RAM as satisfying that
reservation. It's explained in this paper:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.7.3530&rep=rep1&type=pdf.
However, really, the key thing to remember is that the system ensures
that there's always a swap reservation made. To satisfy this the system
may use the swap device or something else.

Inside of a zone, the maximum amount of this anonymous memory that you
can have is controlled by a resource control called 'max_swap'. If you
would try to allocate more anonymous memory than this value, say through
mmap MAP_ANON or the brk system call, then this will fail.

If you're using prstat on a process, the RSS column will show you how
much of the memory of the process is active in DRAM at that moment. If
you look at the VSIZE column, that shows the total size of the address
space of the process, which includes both file-backed and anonymous memory.

Let me know if this helps or what I can better explain.

Thanks,
Robert


-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to