Re: [RESEND v7 1/3] memory: implement memory_block_advise/probe_max_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gregory Price wrote:
> Hotplug memory sources may have opinions on what the memblock size
> should be - usually for alignment purposes.  For example, CXL memory
> extents can be 256MB with a matching alignment. If this size/alignment
> is smaller than the block size, it can result in stranded capacity.
> 
> Implement memory_block_advise_max_size for use prior to allocator init,
> for software to advise the system on the max block size.
> 
> Implement memory_block_probe_max_size for use by arch init code to
> calculate the best block size. Use of advice is architecture defined.
> 
> The probe value can never change after first probe. Calls to advise
> after probe will return -EBUSY to aid debugging.
> 
> On systems without hotplug, always return -ENODEV and 0 respectively.
> 
> Suggested-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> Signed-off-by: Gregory Price <gourry@xxxxxxxxxx>
> Acked-by: David Hildenbrand <david@xxxxxxxxxx>
> Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> Acked-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> Tested-by: Fan Ni <fan.ni@xxxxxxxxxxx>
> ---

[snip]

> +int __init memory_block_advise_max_size(unsigned long size)
> +{
> +	if (!size || !is_power_of_2(size))
> +		return -EINVAL;
> +
> +	if (memory_block_advised_size_queried)
> +		return -EBUSY;
> +
> +	if (memory_block_advised_size) {
> +		memory_block_advised_size = min(memory_block_advised_size,
> +						size);
> +	} else {
> +		memory_block_advised_size = size;
> +	}

NIT: Style: single statements don't need '{}'

Other than that it looks ok.

Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>

[snip]




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux