mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-29 02:14:14 +00:00
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 commit3947be1969
("[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 commit57b552ba0b
("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 commite5d709bb5f
("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>
99 lines
3.7 KiB
Text
99 lines
3.7 KiB
Text
What: /sys/devices/system/memory
|
|
Date: June 2008
|
|
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
|
Description:
|
|
The /sys/devices/system/memory contains a snapshot of the
|
|
internal state of the kernel memory blocks. Files could be
|
|
added or removed dynamically to represent hot-add/remove
|
|
operations.
|
|
Users: hotplug memory add/remove tools
|
|
http://www.ibm.com/developerworks/wikis/display/LinuxP/powerpc-utils
|
|
|
|
What: /sys/devices/system/memory/memoryX/removable
|
|
Date: June 2008
|
|
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
|
Description:
|
|
The file /sys/devices/system/memory/memoryX/removable
|
|
indicates whether this memory block is removable or not.
|
|
This is useful for a user-level agent to determine
|
|
identify removable sections of the memory before attempting
|
|
potentially expensive hot-remove memory operation
|
|
Users: hotplug memory remove tools
|
|
http://www.ibm.com/developerworks/wikis/display/LinuxP/powerpc-utils
|
|
|
|
What: /sys/devices/system/memory/memoryX/phys_device
|
|
Date: September 2008
|
|
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
|
Description:
|
|
The file /sys/devices/system/memory/memoryX/phys_device
|
|
is read-only; it is a legacy interface only ever used on s390x
|
|
to expose the covered storage increment.
|
|
Users: Legacy s390-tools lsmem/chmem
|
|
|
|
What: /sys/devices/system/memory/memoryX/phys_index
|
|
Date: September 2008
|
|
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
|
Description:
|
|
The file /sys/devices/system/memory/memoryX/phys_index
|
|
is read-only and contains the section ID in hexadecimal
|
|
which is equivalent to decimal X contained in the
|
|
memory section directory name.
|
|
|
|
What: /sys/devices/system/memory/memoryX/state
|
|
Date: September 2008
|
|
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
|
Description:
|
|
The file /sys/devices/system/memory/memoryX/state
|
|
is read-write. When read, its contents show the
|
|
online/offline state of the memory section. When written,
|
|
root can toggle the the online/offline state of a removable
|
|
memory section (see removable file description above)
|
|
using the following commands::
|
|
|
|
# echo online > /sys/devices/system/memory/memoryX/state
|
|
# echo offline > /sys/devices/system/memory/memoryX/state
|
|
|
|
For example, if /sys/devices/system/memory/memory22/removable
|
|
contains a value of 1 and
|
|
/sys/devices/system/memory/memory22/state contains the
|
|
string "online" the following command can be executed by
|
|
by root to offline that section::
|
|
|
|
# echo offline > /sys/devices/system/memory/memory22/state
|
|
|
|
Users: hotplug memory remove tools
|
|
http://www.ibm.com/developerworks/wikis/display/LinuxP/powerpc-utils
|
|
|
|
|
|
What: /sys/devices/system/memory/memoryX/valid_zones
|
|
Date: July 2014
|
|
Contact: Zhang Zhen <zhenzhang.zhang@huawei.com>
|
|
Description:
|
|
The file /sys/devices/system/memory/memoryX/valid_zones is
|
|
read-only and is designed to show which zone this memory
|
|
block can be onlined to.
|
|
|
|
What: /sys/devices/system/memoryX/nodeY
|
|
Date: October 2009
|
|
Contact: Linux Memory Management list <linux-mm@kvack.org>
|
|
Description:
|
|
When CONFIG_NUMA is enabled, a symbolic link that
|
|
points to the corresponding NUMA node directory.
|
|
|
|
For example, the following symbolic link is created for
|
|
memory section 9 on node0:
|
|
|
|
/sys/devices/system/memory/memory9/node0 -> ../../node/node0
|
|
|
|
|
|
What: /sys/devices/system/node/nodeX/memoryY
|
|
Date: September 2008
|
|
Contact: Gary Hade <garyhade@us.ibm.com>
|
|
Description:
|
|
When CONFIG_NUMA is enabled
|
|
/sys/devices/system/node/nodeX/memoryY is a symbolic link that
|
|
points to the corresponding /sys/devices/system/memory/memoryY
|
|
memory section directory. For example, the following symbolic
|
|
link is created for memory section 9 on node0.
|
|
|
|
/sys/devices/system/node/node0/memory9 -> ../../memory/memory9
|