Re: [PATCH v6 1/3] mm/memblock: introduce a new helper memblock_estimated_nr_free_pages()

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

 



On Thu, Aug 08, 2024 at 12:14:13AM +0000, Wei Yang wrote:

Hi Wei,

...
> + * Return:
> + * An estimated number of free pages from memblock point of view.
> + */
> +unsigned long __init memblock_estimated_nr_free_pages(void)
> +{
> +	return PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
> +}

This could possibly be short on up to two pages due to lack of alignment.
The current uses are okay, but since you make it generic it probably matters.

Also, the returned value is not an estimation. Meaning the function name
is rather unfortunate AFAICT.

> +#define PHYS_PFN(x)	((unsigned long)((x) >> PAGE_SHIFT))

Thanks!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux