diff mbox

[8/8,linux-next] mm: use SECTION_MASK where possible

Message ID 1480706540-21323-1-git-send-email-fabf@skynet.be (mailing list archive)
State New, archived
Headers show

Commit Message

Fabian Frederick Dec. 2, 2016, 7:22 p.m. UTC
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 kernel/memremap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Dan Williams Dec. 2, 2016, 7:54 p.m. UTC | #1
On Fri, Dec 2, 2016 at 11:22 AM, Fabian Frederick <fabf@skynet.be> wrote:
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  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
diff mbox

Patch

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,