From: Avi Kivity <avi@scylladb.com>
To: linux-mm <linux-mm@kvack.org>
Subject: memfd and transparent hugepages
Date: Mon, 18 Nov 2024 16:13:05 +0200 [thread overview]
Message-ID: <2f7b4534689ec00dc9dd139ec2845c79d1617514.camel@scylladb.com> (raw)
#define _GNU_SOURCE
#include <sys/mman.h>
#include <linux/memfd.h>
#include <unistd.h>
#include <stddef.h>
int main(int ac, char** av) {
size_t memsz = (size_t)2048 << 20;
int fd = memfd_create("memory", MFD_CLOEXEC);
ftruncate(fd, memsz);
void* p = mmap((void*)0x40000000, memsz, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FILE, fd, 0);
madvise(p, memsz, MADV_HUGEPAGE);
madvise(p, memsz, MADV_POPULATE_WRITE);
madvise(p, memsz, MADV_COLLAPSE);
pause();
return 0;
}
While memfd is documented as using anonymous pages, AnonHugePages shows
as zero.
If memfd incompatible with transparent hugepages?
next reply other threads:[~2024-11-18 14:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 14:13 Avi Kivity [this message]
2024-11-18 19:42 ` David Hildenbrand
2024-11-18 20:05 ` Avi Kivity
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=2f7b4534689ec00dc9dd139ec2845c79d1617514.camel@scylladb.com \
--to=avi@scylladb.com \
--cc=linux-mm@kvack.org \
/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