From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Michel Lespinasse <walken@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Subject: Re: Mlocked pages statistics shows bogus value.
Date: Tue, 19 Jan 2016 14:21:01 +0200 [thread overview]
Message-ID: <20160119122101.GA20260@node.shutemov.name> (raw)
In-Reply-To: <201601191936.HAI26031.HOtJQLOMFFFVOS@I-love.SAKURA.ne.jp>
On Tue, Jan 19, 2016 at 07:36:37PM +0900, Tetsuo Handa wrote:
> 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.
Oh. Looks like a bug from 2013...
Thanks for report.
next prev parent reply other threads:[~2016-01-19 12:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 10:36 Mlocked pages statistics shows bogus value Tetsuo Handa
2016-01-19 12:21 ` Kirill A. Shutemov [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160119122101.GA20260@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=walken@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).