Subject: [PATCH v1 00/12] powerpc/pseries: CMM: Implement balloon compaction and remove isolate notifier

From: David Hildenbrand <[email-masked]>
Date: Thu, 31 Oct 2019 15:29:21 +0100

This is the follow-up of:
	https://lkml.org/lkml/2019/9/10/711

We can get rid of the memory isolate notifier by switching to balloon
compaction in powerpc's CMM (Collaborative Memory Management). The memory
isolate notifier was only necessary to allow to offline memory blocks that
contain inflated/"loaned" pages - which also possible when the inflated
pages are movable (via balloon compaction). Having movable pages implies
that memory will also no longer get fragmented when CMM is active.

While I do have access to a LPAR, it does not have CMM active and I have np
clue how to enable it. Instead, I implemented a simple simulation mode. I
did some tests and the whole infrastructure, including page migration,
seems to work fine (e.g., I can still offline memory blocks that contain
inflated pages). Of course, I cannot tell if HW will like the changes,
especially:

1. I now use page_to_phys() to come up with the addresses to report to
   the hypervisor. Hope that's correct.
2. When migrating a page, I first inflate/"loan" the new page and then
   deflate the old page. I have no idea if HW accepts to set pages loaned
   if it didn't request a loan. I assume it does.
3. We might now inflate/deflate pages in parallel (of course, not the
   same page). I have no idea if HW likes that.

It would be good if somebody could either point me at the spec of the
hypervisor interface or verify directly. Also, it would be good if somebody
could test with actual HW that has this feature.

Cc: Alexander Duyck <[email-masked]>
Cc: Alexander Potapenko <[email-masked]>
Cc: Alexey Kardashevskiy <[email-masked]>
Cc: Allison Randal <[email-masked]>
Cc: Andrew Morton <[email-masked]>
Cc: Anshuman Khandual <[email-masked]>
Cc: Anshuman Khandual <[email-masked]>
Cc: Arun KS <[email-masked]>
Cc: Benjamin Herrenschmidt <[email-masked]>
Cc: Christian Brauner <[email-masked]>
Cc: Dan Williams <[email-masked]>
Cc: David Hildenbrand <[email-masked]>
Cc: David Howells <[email-masked]>
Cc: "Enrico Weigelt, metux IT consult" <[email-masked]>
Cc: Gao Xiang <[email-masked]>
Cc: Geert Uytterhoeven <[email-masked]>
Cc: Greg Hackmann <[email-masked]>
Cc: Greg Kroah-Hartman <[email-masked]>
Cc: Konstantin Khlebnikov <[email-masked]>
Cc: Mel Gorman <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Michal Hocko <[email-masked]>
Cc: Mike Rapoport <[email-masked]>
Cc: "Oliver O'Halloran" <[email-masked]>
Cc: Oscar Salvador <[email-masked]>
Cc: Paul Mackerras <[email-masked]>
Cc: Pavel Tatashin <[email-masked]>
Cc: Pingfan Liu <[email-masked]>
Cc: Qian Cai <[email-masked]>
Cc: "Rafael J. Wysocki" <[email-masked]>
Cc: Richard Fontana <[email-masked]>
Cc: Stephen Rothwell <[email-masked]>
Cc: Thiago Jung Bauermann <[email-masked]>
Cc: Thomas Gleixner <[email-masked]>
Cc: Todd Kjos <[email-masked]>
Cc: Vlastimil Babka <[email-masked]>
Cc: Wei Yang <[email-masked]>

David Hildenbrand (12):
  powerpc/pseries: CMM: Implement release() function for sysfs device
  powerpc/pseries: CMM: Report errors when registering notifiers fails
  powerpc/pseries: CMM: Cleanup rc handling in cmm_init()
  powerpc/pseries: CMM: Drop page array
  powerpc/pseries: CMM: Use adjust_managed_page_count() insted of
    totalram_pages_*
  powerpc/pseries: CMM: Rip out memory isolate notifier
  powerpc/pseries: CMM: Convert loaned_pages to an atomic_long_t
  powerpc/pseries: CMM: Implement balloon compaction
  powerpc/pseries: CMM: Switch to balloon_page_alloc()
  powerpc/pseries: CMM: Simulation mode
  mm: remove the memory isolate notifier
  mm: remove "count" parameter from has_unmovable_pages()

 arch/powerpc/platforms/pseries/Kconfig |   1 +
 arch/powerpc/platforms/pseries/cmm.c   | 430 +++++++++++--------------
 drivers/base/memory.c                  |  19 --
 include/linux/memory.h                 |  27 --
 include/linux/page-isolation.h         |   4 +-
 include/uapi/linux/magic.h             |   1 +
 mm/memory_hotplug.c                    |   2 +-
 mm/page_alloc.c                        |  21 +-
 mm/page_isolation.c                    |  27 +-
 9 files changed, 204 insertions(+), 328 deletions(-)

-- 
2.21.0