diff mbox

[RFC,01/10] arm64: mm: move assignment of 'high_memory' before its first use

Message ID 1456174472-30028-2-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel Feb. 22, 2016, 8:54 p.m. UTC
The variable 'high_memory' ends up being referenced in the call to
dma_contiguous_reserve(). So move the assignment before that call.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 arch/arm64/mm/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.5.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Comments

Catalin Marinas Feb. 23, 2016, 12:14 p.m. UTC | #1
On Mon, Feb 22, 2016 at 09:54:23PM +0100, Ard Biesheuvel wrote:
> The variable 'high_memory' ends up being referenced in the call to

> dma_contiguous_reserve(). So move the assignment before that call.

> 

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Does this need cc stable? It looks like we've had this issue for a while
and it ends up being used in cma_declare_contiguous(). So we either get
a high enough value to not affect this function or we don't trigger this
code path very often.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Ard Biesheuvel Feb. 23, 2016, 12:18 p.m. UTC | #2
On 23 February 2016 at 13:14, Catalin Marinas <catalin.marinas@arm.com> wrote:
> On Mon, Feb 22, 2016 at 09:54:23PM +0100, Ard Biesheuvel wrote:

>> The variable 'high_memory' ends up being referenced in the call to

>> dma_contiguous_reserve(). So move the assignment before that call.

>>

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>

> Does this need cc stable? It looks like we've had this issue for a while

> and it ends up being used in cma_declare_contiguous(). So we either get

> a high enough value to not affect this function or we don't trigger this

> code path very often.

>


I would guess cc'ing stable would be appropriate, although I think
keeping it at 0x0 has no ill side effects, other than that the CMA
layer cannot figure out if the allocation is entirely above or
entirely below the highmem limit, and of course, that is kind of moot
on arm64

I haven't noticed any runtime changes with this fixed

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox

Patch

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index e1f425fe5a81..017201982da3 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -235,6 +235,9 @@  void __init arm64_memblock_init(void)
 		arm64_dma_phys_limit = max_zone_dma_phys();
 	else
 		arm64_dma_phys_limit = PHYS_MASK + 1;
+
+	high_memory = __va((memblock_end_of_DRAM() & PAGE_MASK) - 1) + 1;
+
 	dma_contiguous_reserve(arm64_dma_phys_limit);
 
 	memblock_allow_resize();
@@ -259,7 +262,6 @@  void __init bootmem_init(void)
 	sparse_init();
 	zone_sizes_init(min, max);
 
-	high_memory = __va((max << PAGE_SHIFT) - 1) + 1;
 	max_pfn = max_low_pfn = max;
 }