On Mon, Oct 23, 2017 at 07:41:57AM -0400, Marc-André Lureau wrote: > > > ----- Original Message ----- > > On Mon, Oct 23, 2017 at 10:59:09AM +0100, Marc-André Lureau wrote: > > > Add a new memory backend, similar to hostmem-file, except that it > > > doesn't need to create files. It also enforces memory sealing. > > > > > > This backend is mainly useful for sharing the memory with other > > > processes. > > > > > > Note that Linux supports transparent huge-pages of shmem/memfd memory > > > since 4.8. It is relatively easier to set up THP than a dedicate > > > hugepage mount point by using "madvise" in > > > /sys/kernel/mm/transparent_hugepage/shmem_enabled. > > > > > > Since 4.14, memfd allows to set hugetlb requirement explicitly. > > > > > > Usage: > > > -object memory-backend-memfd,id=mem1,size=1G > > > > [snip] > > > > > +static void > > > +memfd_backend_class_init(ObjectClass *oc, void *data) > > > +{ > > > + HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc); > > > + > > > + bc->alloc = memfd_backend_memory_alloc; > > > + > > > + object_class_property_add_bool(oc, "hugetlb", > > > + memfd_backend_get_hugetlb, > > > + memfd_backend_set_hugetlb, > > > + &error_abort); > > > > I tend to think that instead of a bool hugetlb, we should take an > > integer page size instead eg hugepagesize=2M instead of hugetlb=true > > > > Well, how would you then create a memfd without explicit hugetlb > request or one with default hugetlb size?
Hmm, yes, libvirt would not need that, but that would be useful still for direct QEMU users. > I think size should be a different property. I'll add it. Yep ok Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|