I read a little bit more on memory ballooning and virtio-mem and understand that memory ballooning still keeps the inflated page but guest cannot allocate and use it, whereas virtio-mem and memory hotunplug remove the page from Linux completely (i.e., Linux no longer sees the memory). It seems that I am mixing memory offlining and memory hotunplug. IIUC, memory offlining means no one can allocate and use the offlined memory, but Linux still sees it; memory hotunplug means Linux no longer sees it (no related memmap and other metadata). Am I getting it right? > > Some PageOffline pages can be migrated using the non-folio migration: this is done for memory ballooning (memory comapction). As they get migrated, they are freed back to the buddy, PageOffline() is cleared -- they become PageBuddy() -- and the above applies. After a PageOffline page is migrated, the destination page becomes PageOffline, right? OK, I see it in balloon_page_insert(). > > Other PageOffline pages can be skipped during memory offlining (virtio-mem use case, what we are doing her). We don't want them to ever go through the buddy, especially because if memory offlining fails they must definitely not be treated like free pages that can be allocated immediately. What do you mean by "skipped during memory offlining"? Are you implying when virtio-mem is offlining some pages by marking it PageOffline and PG_offline_skippable, someone else can do memory offlining in parallel? > > Next, the page is removed from its memory >> block. When will PG_offline_skippable be used? The second phase when >> the page is being removed from its memory block? > > PG_offline_skippable is used during memory offlining, while we look for any pages that are not PageBuddy (... or hwpoisoned ...), to migrate them off the memory so they get converted to PageBuddy. > > PageOffline + PageOfflineSkippable are checked on that phase, such that they don't require any migration. Hmm, if you just do not want to get PageOffline migrated, not setting it __PageMovable would work right? PageOffline + __PageMovable is used by ballooning, as these inflated pages can be migrated. PageOffline without __PageMovable should be virtio-mem. Am I missing any other user? -- Best Regards, Yan, Zi