Re: [PATCH 8/8 linux-next] mm: use SECTION_MASK where possible
From: Dan Williams
Date: Fri Dec 02 2016 - 14:54:30 EST
On Fri, Dec 2, 2016 at 11:22 AM, Fabian Frederick <fabf@xxxxxxxxx> wrote:
> Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
> ---
> kernel/memremap.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index 1bb5eec..8ebf9dd 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -198,7 +198,7 @@ static void pgmap_radix_release(struct resource *res)
> {
> resource_size_t key, align_start, align_size, align_end;
>
> - align_start = res->start & ~(SECTION_SIZE - 1);
> + align_start = res->start & SECTION_MASK;
> align_size = ALIGN(resource_size(res), SECTION_SIZE);
> align_end = align_start + align_size - 1;
>
> @@ -244,7 +244,7 @@ static void devm_memremap_pages_release(struct device *dev, void *data)
> }
>
> /* pages are dead and unused, undo the arch mapping */
> - align_start = res->start & ~(SECTION_SIZE - 1);
> + align_start = res->start & SECTION_MASK;
> align_size = ALIGN(resource_size(res), SECTION_SIZE);
> arch_remove_memory(align_start, align_size);
> untrack_pfn(NULL, PHYS_PFN(align_start), align_size);
> @@ -289,7 +289,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
> int error, nid, is_ram;
> unsigned long pfn;
>
> - align_start = res->start & ~(SECTION_SIZE - 1);
> + align_start = res->start & SECTION_MASK;
> align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
> - align_start;
> is_ram = region_intersects(align_start, align_size,
This is addressed in the sub-section hotplug series:
"[PATCH 03/11] mm: introduce common definitions for the size and mask
of a section"
https://lkml.org/lkml/2016/12/1/746