On 31.07.19 15:42, David Hildenbrand wrote: > On 31.07.19 15:25, Michal Hocko wrote: >> On Wed 31-07-19 15:12:12, David Hildenbrand wrote: >>> On 31.07.19 14:43, Michal Hocko wrote: >>>> On Wed 31-07-19 14:22:13, David Hildenbrand wrote: >>>>> Each memory block spans the same amount of sections/pages/bytes. The size >>>>> is determined before the first memory block is created. No need to store >>>>> what we can easily calculate - and the calculations even look simpler now. >>>> >>>> While this cleanup helps a bit, I am not sure this is really worth >>>> bothering. I guess we can agree when I say that the memblock interface >>>> is suboptimal (to put it mildly). Shouldn't we strive for making it >>>> a real hotplug API in the future? What do I mean by that? Why should >>>> be any memblock fixed in size? Shouldn't we have use hotplugable units >>>> instead (aka pfn range that userspace can work with sensibly)? Do we >>>> know of any existing userspace that would depend on the current single >>>> section res. 2GB sized memblocks? >>> >>> Short story: It is already ABI (e.g., >>> /sys/devices/system/memory/block_size_bytes) - around since 2005 (!) - >>> since we had memory block devices. >>> >>> I suspect that it is mainly manually used. But I might be wrong. >> >> Any pointer to the real userspace depending on it? Most usecases I am >> aware of rely on udev events and either onlining or offlining the memory >> in the handler. > > Yes, that's also what I know - onlining and triggering kexec(). > > On s390x, admins online sub-increments to selectively add memory to a VM > - but we could still emulate that by adding memory for that use case in > the kernel in the current granularity. See > > https://books.google.de/books?id=afq4CgAAQBAJ&pg=PA117&lpg=PA117&dq=/sys/devices/system/memory/block_size_bytes&source=bl&ots=iYk_vW5O4G&sig=ACfU3U0s-O-SOVaQO-7HpKO5Hj866w9Pxw&hl=de&sa=X&ved=2ahUKEwjOjPqIot_jAhVPfZoKHcxpAqcQ6AEwB3oECAgQAQ#v=onepage&q=%2Fsys%2Fdevices%2Fsystem%2Fmemory%2Fblock_size_bytes&f=false > >> >> I know we have documented this as an ABI and it is really _sad_ that >> this ABI didn't get through normal scrutiny any user visible interface >> should go through but these are sins of the past... > > A quick google search indicates that > > Kata containers queries the block size: > https://github.com/kata-containers/runtime/issues/796 > > Powerpc userspace queries it: > https://groups.google.com/forum/#!msg/powerpc-utils-devel/dKjZCqpTxus/AwkstV2ABwAJ FWIW, powerpc-utils also uses the "removable" property - which means we're also stuck with that unfortunately. :( -- Thanks, David / dhildenb