linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFCv2 0/4] mm/memory_hotplug: Introduce memory block types
@ 2018-11-30 17:59 David Hildenbrand
  2018-11-30 17:59 ` [PATCH RFCv2 1/4] " David Hildenbrand
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: David Hildenbrand @ 2018-11-30 17:59 UTC (permalink / raw)
  To: linux-mm
  Cc: Oscar Salvador, Rafael J. Wysocki, Michal Hocko, linux-ia64,
	linux-sh, Peter Zijlstra, Dave Hansen, David Hildenbrand,
	Michal Hocko, Vitaly Kuznetsov, Pavel Tatashin, Rich Felker,
	Arun KS, H. Peter Anvin, Stephen Rothwell, Rashmica Gupta,
	K. Y. Srinivasan, Dan Williams, Paul Mackerras, Pavel Tatashin,
	linux-s390, Michael Neuling, Stefano Stabellini, Dave Jiang,
	Yoshinori Sato, Logan Gunthorpe, x86, YueHaibing, Pavel Tatashin,
	Matthew Wilcox, Ingo Molnar, linux-acpi, Ingo Molnar, xen-devel,
	Michal Suchánek, Len Brown, Fenghua Yu,
	Jan H. Schönherr, Juergen Gross, Vasily Gorbik, Rob Herring,
	mike.travis@hpe.com, Heiko Carstens, Haiyang Zhang,
	Jonathan Neuschäfer, Nicholas Piggin,
	Jérôme Glisse, Mike Rapoport, Borislav Petkov,
	Andy Lutomirski, Nathan Fontenot, Stephen Hemminger,
	Boris Ostrovsky, Wei Yang, Joonsoo Kim, Oscar Salvador, Tony Luck,
	Andrew Banman, Mathieu Malaterre, Greg Kroah-Hartman,
	Rafael J. Wysocki, linux-kernel, Mauricio Faria de Oliveira,
	Thomas Gleixner, Martin Schwidefsky, devel, Andrew Morton,
	linuxppc-dev, Kirill A. Shutemov

This is the second approach, introducing more meaningful memory block
types and not changing online behavior in the kernel. It is based on
latest linux-next.

As we found out during dicussion, user space should always handle onlining
of memory, in any case. However in order to make smart decisions in user
space about if and how to online memory, we have to export more information
about memory blocks. This way, we can formulate rules in user space.

One such information is the type of memory block we are talking about.
This helps to answer some questions like:
- Does this memory block belong to a DIMM?
- Can this DIMM theoretically ever be unplugged again?
- Was this memory added by a balloon driver that will rely on balloon
  inflation to remove chunks of that memory again? Which zone is advised?
- Is this special standby memory on s390x that is usually not automatically
  onlined?

And in short it helps to answer to some extend (excluding zone imbalances)
- Should I online this memory block?
- To which zone should I online this memory block?
... of course special use cases will result in different anwers. But that's
why user space has control of onlining memory.

More details can be found in Patch 1 and Patch 3.
Tested on x86 with hotplugged DIMMs. Cross-compiled for PPC and s390x.


Example:
$ udevadm info -q all -a /sys/devices/system/memory/memory0
	KERNEL=="memory0"
	SUBSYSTEM=="memory"
	DRIVER==""
	ATTR{online}=="1"
	ATTR{phys_device}=="0"
	ATTR{phys_index}=="00000000"
	ATTR{removable}=="0"
	ATTR{state}=="online"
	ATTR{type}=="boot"
	ATTR{valid_zones}=="none"
$ udevadm info -q all -a /sys/devices/system/memory/memory90
	KERNEL=="memory90"
	SUBSYSTEM=="memory"
	DRIVER==""
	ATTR{online}=="1"
	ATTR{phys_device}=="0"
	ATTR{phys_index}=="0000005a"
	ATTR{removable}=="1"
	ATTR{state}=="online"
	ATTR{type}=="dimm"
	ATTR{valid_zones}=="Normal"


RFC -> RFCv2:
- Now also taking care of PPC (somehow missed it :/ )
- Split the series up to some degree (some ideas on how to split up patch 3
  would be very welcome)
- Introduce more memory block types. Turns out abstracting too much was
  rather confusing and not helpful. Properly document them.

Notes:
- I wanted to convert the enum of types into a named enum but this
  provoked all kinds of different errors. For now, I am doing it just like
  the other types (e.g. online_type) we are using in that context.
- The "removable" property should never have been named like that. It
  should have been "offlinable". Can we still rename that? E.g. boot memory
  is sometimes marked as removable ...

David Hildenbrand (4):
  mm/memory_hotplug: Introduce memory block types
  mm/memory_hotplug: Replace "bool want_memblock" by "int type"
  mm/memory_hotplug: Introduce and use more memory types
  mm/memory_hotplug: Drop MEMORY_TYPE_UNSPECIFIED

 arch/ia64/mm/init.c                           |  4 +-
 arch/powerpc/mm/mem.c                         |  4 +-
 arch/powerpc/platforms/powernv/memtrace.c     |  9 +--
 .../platforms/pseries/hotplug-memory.c        |  7 +-
 arch/s390/mm/init.c                           |  4 +-
 arch/sh/mm/init.c                             |  4 +-
 arch/x86/mm/init_32.c                         |  4 +-
 arch/x86/mm/init_64.c                         |  8 +--
 drivers/acpi/acpi_memhotplug.c                | 16 ++++-
 drivers/base/memory.c                         | 60 ++++++++++++++--
 drivers/hv/hv_balloon.c                       |  3 +-
 drivers/s390/char/sclp_cmd.c                  |  3 +-
 drivers/xen/balloon.c                         |  2 +-
 include/linux/memory.h                        | 69 ++++++++++++++++++-
 include/linux/memory_hotplug.h                | 18 ++---
 kernel/memremap.c                             |  6 +-
 mm/memory_hotplug.c                           | 29 ++++----
 17 files changed, 194 insertions(+), 56 deletions(-)

-- 
2.17.2


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

end of thread, other threads:[~2019-03-27 20:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-30 17:59 [PATCH RFCv2 0/4] mm/memory_hotplug: Introduce memory block types David Hildenbrand
2018-11-30 17:59 ` [PATCH RFCv2 1/4] " David Hildenbrand
2018-12-01  1:25   ` Wei Yang
2018-12-03 10:32     ` David Hildenbrand
2018-12-03 20:58       ` Wei Yang
2018-11-30 17:59 ` [PATCH RFCv2 2/4] mm/memory_hotplug: Replace "bool want_memblock" by "int type" David Hildenbrand
2018-12-01  1:50   ` Wei Yang
2018-12-03 10:33     ` David Hildenbrand
2018-11-30 17:59 ` [PATCH RFCv2 3/4] mm/memory_hotplug: Introduce and use more memory types David Hildenbrand
2018-12-04  9:44   ` Michal Suchánek
2018-12-04  9:47     ` David Hildenbrand
2018-11-30 17:59 ` [PATCH RFCv2 4/4] mm/memory_hotplug: Drop MEMORY_TYPE_UNSPECIFIED David Hildenbrand
2018-12-01  0:48 ` [PATCH RFCv2 0/4] mm/memory_hotplug: Introduce memory block types Wei Yang
2018-12-20 12:58 ` David Hildenbrand
2018-12-20 13:08   ` Michal Hocko
2018-12-20 13:16     ` David Hildenbrand
2019-03-27 16:03     ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).