linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* memfd and transparent hugepages
@ 2024-11-18 14:13 Avi Kivity
  2024-11-18 19:42 ` David Hildenbrand
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2024-11-18 14:13 UTC (permalink / raw)
  To: linux-mm

#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?



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

end of thread, other threads:[~2024-11-18 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-18 14:13 memfd and transparent hugepages Avi Kivity
2024-11-18 19:42 ` David Hildenbrand
2024-11-18 20:05   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox