All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/8] mm: online/offline 4MB chunks controlled by device driver
@ 2018-04-13 13:16 David Hildenbrand
  2018-04-13 13:16   ` David Hildenbrand
                   ` (10 more replies)
  0 siblings, 11 replies; 50+ messages in thread
From: David Hildenbrand @ 2018-04-13 13:16 UTC (permalink / raw)
  To: linux-mm; +Cc: David Hildenbrand

I am right now working on a paravirtualized memory device ("virtio-mem").
These devices control a memory region and the amount of memory available
via it. Memory will not be indicated via ACPI and friends, the device
driver is responsible for it.

When the device driver starts up, it will add and online the requested
amount of memory from its assigned physical memory region. On request, it can
add (online) either more memory or try to remove (offline) memory.

As we want to be able to add small chunks of memory to a VM, it looks
like we can do that under Linux in a 4MB granularity. At least with
these patches on top of Linus tree :)

We add a segment and online only 4MB parts of it on demand. So the other
memory might not be accessible. For kdump and offline code, we have to
mark pages as offline (e.g. as these pages might not be backed by real
memory in the hypervisor).

In contrast to existing balloon solutions:
- The device is responsible for its own memory only.
- Works on a coarser granularity (e.g. 4MB because that's what we can
  online/offline in Linux). We are not using the buddy allocator when unplugging
  but really search for chunks of memory we can offline.
- A device can belong to exactly one NUMA node. This way we can online/offline
  memory in a fine granularity NUMA aware.
- Architectures that don't have proper memory hotplug interfaces (e.g. s390x)
  get memory hotplug support. I have a prototype for s390x.
- Once all 4MB chunks of a memory block are offline, we can remove the
  memory block and therefore the struct pages (seems to work in my prototype),
  which is nice.

Todo:
- We might have to add a parameter to offline_pages(), telling it to not
  try forever but abort in case it takes too long.
- Performance improvements. But I don't care about that right now.

Latest work d0dc12e86b31 "mm/memory_hotplug: optimize memory hotplug"
collides with my work and I wasn't able to get it running within 30min,
so I simply revert it to not stop discussion of this O:-)

On request I can post the current virtio-mem prototype.

Feelings? Recommandations? Things I am ignoring?


David Hildenbrand (8):
  mm/memory_hotplug: Revert "mm/memory_hotplug: optimize memory hotplug"
  mm: introduce PG_offline
  mm: use PG_offline in online/offlining code
  kdump: expose PG_offline
  mm: only mark section offline when all pages are offline
  mm: offline_pages() is also limited by MAX_ORDER
  mm: allow to control onlining/offlining of memory by a driver
  mm: export more functions used to online/offline memory

 drivers/base/memory.c          | 22 ++++++----
 drivers/base/node.c            |  2 -
 drivers/hv/hv_balloon.c        |  2 +-
 drivers/xen/balloon.c          |  2 +-
 include/linux/memory.h         |  2 +-
 include/linux/memory_hotplug.h |  4 +-
 include/linux/page-flags.h     | 10 +++++
 include/trace/events/mmflags.h |  9 +++-
 kernel/crash_core.c            |  3 ++
 mm/memory_hotplug.c            | 93 +++++++++++++++++++++++++++++++++++-------
 mm/page_alloc.c                | 35 ++++++++++------
 mm/sparse.c                    | 33 +++++++++++----
 12 files changed, 168 insertions(+), 49 deletions(-)

-- 
2.14.3

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

end of thread, other threads:[~2018-04-30  6:31 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 13:16 [PATCH RFC 0/8] mm: online/offline 4MB chunks controlled by device driver David Hildenbrand
2018-04-13 13:16 ` [PATCH RFC 1/8] mm/memory_hotplug: Revert "mm/memory_hotplug: optimize memory hotplug" David Hildenbrand
2018-04-13 13:16   ` David Hildenbrand
2018-04-13 13:16 ` [PATCH RFC 2/8] mm: introduce PG_offline David Hildenbrand
2018-04-13 13:16   ` David Hildenbrand
2018-04-13 13:40   ` Michal Hocko
2018-04-13 13:46     ` David Hildenbrand
2018-04-17 11:50     ` David Hildenbrand
2018-04-13 17:11   ` Matthew Wilcox
2018-04-16  8:31     ` David Hildenbrand
2018-04-21 16:52     ` Vlastimil Babka
2018-04-22  3:01       ` Matthew Wilcox
2018-04-22  8:17         ` David Hildenbrand
2018-04-22 14:02           ` Matthew Wilcox
2018-04-22 15:13             ` David Hildenbrand
2018-04-29 21:08               ` Michal Hocko
2018-04-30  6:31                 ` David Hildenbrand
2018-04-20  7:30   ` David Hildenbrand
2018-04-13 13:16 ` [PATCH RFC 3/8] mm: use PG_offline in online/offlining code David Hildenbrand
2018-04-13 13:16   ` David Hildenbrand
2018-04-13 13:31 ` [PATCH RFC 4/8] kdump: expose PG_offline David Hildenbrand
2018-04-13 13:33 ` [PATCH RFC 5/8] mm: only mark section offline when all pages are offline David Hildenbrand
2018-04-13 13:33   ` David Hildenbrand
2018-04-13 13:33 ` [PATCH RFC 6/8] mm: offline_pages() is also limited by MAX_ORDER David Hildenbrand
2018-04-13 13:33   ` David Hildenbrand
2018-04-13 13:33 ` [PATCH RFC 7/8] mm: allow to control onlining/offlining of memory by a driver David Hildenbrand
2018-04-13 13:33 ` David Hildenbrand
2018-04-13 13:33   ` David Hildenbrand
2018-04-13 15:59   ` Michal Hocko
2018-04-13 15:59   ` Michal Hocko
2018-04-13 16:32     ` David Hildenbrand
2018-04-13 16:32     ` David Hildenbrand
2018-04-13 13:33 ` [PATCH RFC 8/8] mm: export more functions used to online/offline memory David Hildenbrand
2018-04-13 13:33   ` David Hildenbrand
2018-04-13 13:44 ` [PATCH RFC 0/8] mm: online/offline 4MB chunks controlled by device driver Michal Hocko
2018-04-13 14:01   ` David Hildenbrand
2018-04-13 14:20     ` Michal Hocko
2018-04-13 14:59       ` David Hildenbrand
2018-04-13 15:02   ` David Hildenbrand
2018-04-13 16:03     ` Michal Hocko
2018-04-13 16:36       ` David Hildenbrand
2018-04-13 15:59 ` Michal Hocko
2018-04-13 16:31   ` David Hildenbrand
2018-04-16 14:08     ` Michal Hocko
2018-04-16 14:48       ` David Hildenbrand
2018-04-18 15:46       ` David Hildenbrand
2018-04-19  7:33         ` Michal Hocko
2018-04-26 15:30           ` David Hildenbrand
2018-04-29 21:05             ` Michal Hocko
2018-04-30  6:24               ` David Hildenbrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.