kernel_optimize_test/Documentation/admin-guide/mm
David Hildenbrand 8876cc237e drivers/base/memory: don't store phys_device in memory blocks
[ Upstream commit e9a2e48e8704c9d20a625c6f2357147d03ea7b97 ]

No need to store the value for each and every memory block, as we can
easily query the value at runtime.  Reshuffle the members to optimize the
memory layout.  Also, let's clarify what the interface once was used for
and why it's legacy nowadays.

"phys_device" was used on s390x in older versions of lsmem[2]/chmem[3],
back when they were still part of s390x-tools.  They were later replaced
by the variants in linux-utils.  For example, RHEL6 and RHEL7 contain
lsmem/chmem from s390-utils.  RHEL8 switched to versions from util-linux
on s390x [4].

"phys_device" was added with sysfs support for memory hotplug in commit
3947be1969 ("[PATCH] memory hotplug: sysfs and add/remove functions") in
2005.  It always returned 0.

s390x started returning something != 0 on some setups (if sclp.rzm is set
by HW) in 2010 via commit 57b552ba0b ("memory hotplug/s390: set
phys_device").

For s390x, it allowed for identifying which memory block devices belong to
the same storage increment (RZM).  Only if all memory block devices
comprising a single storage increment were offline, the memory could
actually be removed in the hypervisor.

Since commit e5d709bb5f ("s390/memory hotplug: provide
memory_block_size_bytes() function") in 2013 a memory block device spans
at least one storage increment - which is why the interface isn't really
helpful/used anymore (except by old lsmem/chmem tools).

There were once RFC patches to make use of "phys_device" in ACPI context;
however, the underlying problem could be solved using different interfaces
[1].

[1] https://patchwork.kernel.org/patch/2163871/
[2] https://github.com/ibm-s390-tools/s390-tools/blob/v2.1.0/zconf/lsmem
[3] https://github.com/ibm-s390-tools/s390-tools/blob/v2.1.0/zconf/chmem
[4] https://bugzilla.redhat.com/show_bug.cgi?id=1504134

Link: https://lkml.kernel.org/r/20210201181347.13262-2-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Vaibhav Jain <vaibhav@linux.ibm.com>
Cc: Tom Rix <trix@redhat.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-17 17:06:25 +01:00
..
cma_debugfs.rst docs: admin-guide: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
concepts.rst docs/mm: concepts.rst: remove unnecessary word 2020-07-23 14:02:58 -06:00
hugetlbpage.rst doc/vm: fix typo in the hugetlb admin documentation 2020-10-13 18:38:33 -07:00
idle_page_tracking.rst
index.rst docs: admin-guide/mm/index: Fix reference to nonexistent document 2020-07-23 14:21:37 -06:00
ksm.rst Replace HTTP links with HTTPS ones: Documentation/admin-guide 2020-07-05 14:13:00 -06:00
memory-hotplug.rst drivers/base/memory: don't store phys_device in memory blocks 2021-03-17 17:06:25 +01:00
nommu-mmap.rst docs: move nommu-mmap.txt to admin-guide and rename to ReST 2020-06-26 11:33:35 -06:00
numa_memory_policy.rst mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00
numaperf.rst docs: mm: numaperf.rst Add brief description for access class 1. 2020-10-02 18:51:57 +02:00
pagemap.rst mm: convert PG_balloon to PG_offline 2019-03-05 21:07:14 -08:00
soft-dirty.rst
transhuge.rst doc: THP CoW fault no longer allocate THP 2020-06-26 00:27:37 -07:00
userfaultfd.rst mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00