virtio-mem: Allow to offline partially unplugged memory blocks
authorDavid Hildenbrand <david@redhat.com>
Thu, 7 May 2020 14:01:31 +0000 (16:01 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 4 Jun 2020 19:36:52 +0000 (15:36 -0400)
commit8e5c921ca0cd9aa59386e6be4b86b32f0ba7296b
tree4e40dcdd1cd0117d2e2641668bf71a5404421eec
parentaa218795cb5fd583c94fc838dc76b7379dc4976a
virtio-mem: Allow to offline partially unplugged memory blocks

Dropping the reference count of PageOffline() pages during MEM_GOING_ONLINE
allows offlining code to skip them. However, we also have to clear
PG_reserved, because PG_reserved pages get detected as unmovable right
away. Take care of restoring the reference count when offlining is
canceled.

Clarify why we don't have to perform any action when unloading the
driver. Also, let's add a warning if anybody is still holding a
reference to unplugged pages when offlining.

Tested-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20200507140139.17083-8-david@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_mem.c