-----Original Message-----
From: [email protected] [mailto:rhelv5-list-
[email protected]] On Behalf Of Vu Pham
Sent: 13 June 2009 03:08
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] Cannot get system to use swap when
hugepages&memlock are configured.

What is the output of "cat /proc/meminfo | grep -i commit" and value
of
vm.overcommit_memory and vm.overcommit_ratio ?

[r...@psl-cu ~]# grep -i commit /proc/meminfo
CommitLimit:  10313264 kB
Committed_AS:   641236 kB

[r...@psl-cu ~]# sysctl -q vm.overcommit_memory
vm.overcommit_memory = 0

[r...@psl-cu ~]# sysctl -q vm.overcommit_ratio
vm.overcommit_ratio = 50



Nick, I should have asked you those values when the system is under your hammer test. IIRC, Commited_As shows how much memory requested by processes and approved by kernel (it is not necessarily those memory are *really* in use now), and CommitLimit shows the maximum memory the kernel can accept for requests for normal pages ( not huge pages). Because you set aside 6G in huge pages and CommitedAs is about 6G think your system not under stress tests now.


To test the swap, I wrote a small program to allocate memory, but not use that memory at all at first. The amount of memory allocation is selected so that Commited_As gets very close to CommitLimit. When the program starts writing to the allocated memory then the swap activity starts quickly.

It is very short program and its only parameter is the number of MiB the program asks for. You can try it. At every step of the program, see output of top and grep -i commit /proc/meminfo.



#include <stdio.h>
#include <stdlib.h>
main(int argc, char ** argv) {
char *p;
long MiB=1024*1024l;
long multiply = 1;
long i;
        if( argc != 1 ) {
                multiply = atol(argv[1]);
        }
        p = (char *)malloc(multiply*MiB*sizeof(char));
        if( p== NULL ) {
                printf("failed at size=%ld MiB\n",multiply);
                exit(-1);
        } else {
                printf("passed at size=%ld MiB\n",multiply);
                printf("press Enter to start writing memory\n");
                getchar();
                for( i = 0; i < multiply*MiB; i++ )
                        *(p+i)=1;
                printf("press Enter to exit");
                getchar();
                free(p);
        }

}


Vu

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to