Mlocked pages statistics shows bogus value.

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

 



While reading OOM report from Jan Stancek, I noticed that
NR_MLOCK statistics shows bogus values.


Steps to reproduce:

(1) Check Mlocked: field of /proc/meminfo or mlocked: field of SysRq-m.

(2) Compile and run below program with appropriate size as argument.
    There is no need to invoke the OOM killer.

----------
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(int argc, char *argv[])
{
	unsigned long length = atoi(argv[1]);
	void *addr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
	if (addr == MAP_FAILED)
		printf("mmap() failed\n");
	else if (mlock(addr, length) == -1)
		printf("mlock() failed\n");
	else
		printf("MLocked %lu bytes\n", length);
	return 0;
}
----------

(3) Check Mlocked: field or mlocked: field again.
    You can see the value became very large due to
    NR_MLOCK counter going negative.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]