From: Michal Hocko <mhocko@kernel.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
linux-mm@kvack.org, Paul Cassella <cassella@cray.com>
Subject: Re: hugetlb: reservation race leading to under provisioning
Date: Fri, 6 Jan 2017 16:01:21 +0100 [thread overview]
Message-ID: <20170106150121.GP5556@dhcp22.suse.cz> (raw)
In-Reply-To: <20170106085808.GE5556@dhcp22.suse.cz>
I have only now realized I haven't attached the promissed program to
replicate the issue.
$ cat badmmap.c
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <hugetlbfs.h>
#include <sys/mman.h>
int main(int argc, const char **argv) {
const size_t len = 224 * 1024 * 1024;
int count = (argc > 1) ? atoi(argv[1]) : 1000;
int i;
for (i = 0; i < count; ++i) {
int fd = hugetlbfs_unlinked_fd();
void *ptr = mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
fprintf(stderr, "mmap() failed on iteration %d (%s)\n", i, strerror(errno));
return 1;
}
close(fd);
if (munmap(ptr, len) < 0) {
fprintf(stderr, "munmap() failed on iteration %d (%s)\n", i, strerror(errno));
return 1;
}
}
printf("PASSED %d iters\n", count);
return 0;
}
$ cc -o badmmap badmmap.c -lhugetlbfs
Run 8 or so instances in parallel to reproduce.
--
Michal Hocko
SUSE Labs
--
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>
next prev parent reply other threads:[~2017-01-06 15:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 15:15 Michal Hocko
2017-01-06 0:48 ` Mike Kravetz
2017-01-06 8:58 ` Michal Hocko
2017-01-06 15:01 ` Michal Hocko [this message]
2017-01-06 21:57 ` Paul Cassella
2017-01-08 19:08 ` Mike Kravetz
2017-01-09 10:25 ` Michal Hocko
2017-01-09 8:58 ` 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=20170106150121.GP5556@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=cassella@cray.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=n-horiguchi@ah.jp.nec.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