All of lore.kernel.org
 help / color / mirror / Atom feed
* Mlocked pages statistics shows bogus value.
@ 2016-01-19 10:36 Tetsuo Handa
  2016-01-19 12:21 ` Kirill A. Shutemov
  0 siblings, 1 reply; 8+ messages in thread
From: Tetsuo Handa @ 2016-01-19 10:36 UTC (permalink / raw)
  To: linux-mm

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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-20 10:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 10:36 Mlocked pages statistics shows bogus value Tetsuo Handa
2016-01-19 12:21 ` Kirill A. Shutemov
2016-01-19 12:46   ` Tetsuo Handa
2016-01-19 13:01     ` Kirill A. Shutemov
2016-01-19 13:38       ` Tetsuo Handa
2016-01-20  9:59         ` Heiko Carstens
2016-01-20 10:04         ` Heiko Carstens
2016-01-19 18:32   ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.