>> >>> >>> or >>> add_memory(0x1000, size_memory_block * 3); >>> >>> [memblock #0 ] >>> [0 - 1533 pfns ] - vmemmap for section#{0-2} >>> [1534 - 98304 pfns] - normal memory >>> >>> When using larger memory blocks (1GB or 2GB), the principle is the same. >>> >>> Of course, per whole-range granularity is nicer when it comes to have a large >>> contigous area, while per memory-block granularity allows us to have flexibility >>> when removing the memory. >> >> E.g., in my virtio-mem I am currently adding all memory blocks >> separately either way (to guranatee that remove_memory() works cleanly - >> see __release_memory_resource()), and to control the amount of >> not-offlined memory blocks (e.g., to make user space is actually >> onlining them). As it's just a prototype, this might change of course in >> the future. > > What is virtio-mem for? Did it that raised from a need? > Is it something you could try this patch on? virtio-mem is a paravirtualized way of hotplugging/removing to/from a guest. (similar to, but different to e.g., the hv-balloon). It adds/removes memory to/from the system. In the long term, it will try to also act similar-but different to a balloon - but that will require more work. In the first shot, it's all about adding/removing memory in the smaller granularity possible. The old prototype was https://lwn.net/Articles/755423/ Since then, a lot changed. Some more updated information is at https://events.linuxfoundation.org/wp-content/uploads/2017/12/virtio-mem-Paravirtualized-Memory-David-Hildenbrand-Red-Hat-1.pdf There is also a recording of the presentation on youtube. The current prototype is unfortunately not in a state yet that allows me to test with this patch set - my Master's thesis consumed most of my energy during the last year. I just started hacking on it again. -- Thanks, David / dhildenb