Re: Resident memory set size
Michael Kelly, le lun. 12 mai 2025 08:15:10 +0100, a ecrit:
> As part of this research I have also come across another feature that arises
> when running low on memory. I have a virtual machine with 2GB of RAM and a
> very simple test program to gobble 400M of memory per instance (below). I
> run 2 of these and as expected each process has a virtual size of ~550M and
> an RSS of 400M. I then run a 3rd instance to consume a further 400M. This
> causes memory from the 1st of my test programs to have some of its memory
> paged out and its RSS drops to about 150M.
>
> That all seems quite reasonable until you discover that no memory is
> actually being sent to swap as there are no messages sent to the pager.
Ouch, that's not supposed to behave so :)
> I was so surprised by this that I actually commented out all of the
> code in vm_pageout_scan except for the page balancing but it still did
> the same.
Have you tried commenting the page balancing?
The issue could match the issues I'm still experiencing on buildds where
I have just disabled swap.
> It is the page balancing that is reducing the resident memory
> total for my first process. Each page that is moved gets marked
> as VM_PROT_NONE and the task's (pmap) resident_count decremented
> accordingly. There doesn't seem to be any equivalent increment
> associated with the page that it is moved to.
That's odd indeed, do you have the series of calls that leads to the
decrement? (e.g. a backtrace)
Your test case is valid, it'll be useful to investigate further.
Samuel
Reply to: