Skip to contentSkip to conversation

ARM: mm: Align bank start to MAX_ORDER_NR_PAGES

PATCH New Johan Palsson 3 participants 3 messages Sep 28, 2011 – Oct 4, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: mm: Align bank start to MAX_ORDER_NR_PAGES

The VM subsystem assumes that there are valid memmap entries from the bank start aligned to MAX_ORDER_NR_PAGES.

Cc stable at kernel.org
Cc Russell King <[email protected]>
Cc Michael Bohan <[email protected]>
Cc Nicolas Pitre <[email protected]>
---
 arch/arm/mm/init.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mm/init.c +7 -0
index cc7e2d8..f8037ba 100644
@@ -496,6 +496,13 @@ static void __init free_unused_memmap(struct meminfo *mi)
 		 */
 		bank_start = min(bank_start,
 				 ALIGN(prev_bank_end, PAGES_PER_SECTION));
+#else
+		/*
+		 * Align down here since the VM subsystem insists that the
+		 * memmap entries are valid from the bank start aligned to
+		 * MAX_ORDER_NR_PAGES.
+		 */
+		bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
 #endif
 		/*
 		 * If we had a previous bank, and there is a space
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 1/1 ARM: mm: Align bank start to MAX_ORDER_NR_PAGES

Quoted 10 lines · Johan Palsson

The VM subsystem assumes that there are valid memmap entries from the bank start aligned to MAX_ORDER_NR_PAGES.

Cc stable at kernel.org
Cc Russell King <[email protected]>
Cc Michael Bohan <[email protected]>
Cc Nicolas Pitre <[email protected]>

I should mention that this is triggered a lot by our platform using several disparate mem=n arguments on the command line, chopping out pieces of memory here and there.

I will repost with a more descriptive message and then I'll put it into the patch tracker, as it's a blocker already on 3.0 for us.

Yours,
Linus Walleij

#2 lore raw

PATCH 1/1 ARM: mm: Align bank start to MAX_ORDER_NR_PAGES

In reply to Johan Palsson
Quoted 19 lines · Johan Palsson

The VM subsystem assumes that there are valid memmap entries from the bank start aligned to MAX_ORDER_NR_PAGES.

Cc stable at kernel.org
Cc Russell King<[email protected]>
Cc Michael Bohan<[email protected]>
Cc Nicolas Pitre<[email protected]>
---
  arch/arm/mm/init.c |    7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mm/init.c +0 -0
index cc7e2d8..f8037ba 100644

arch/arm/mm/init.c static void __init free_unused_memmap(struct meminfo *mi) · line 501

Quoted 6 lines
arch/arm/mm/init.c +3 -0
@@ -496,6 +496,13 @@ static void __init free_unused_memmap(struct meminfo *mi)
  		 */
  		bank_start = min(bank_start,
  				 ALIGN(prev_bank_end, PAGES_PER_SECTION));
+#else
+		/*
+		 * Align down here since the VM subsystem insists that the

Can we change this to say 'Round down here' instead of 'Align down here'? For consistency, we should probably change the comment and code for the prev_bank_end case below to say 'Round up' and use round_up instead of ALIGN().

arch/arm/mm/init.c static void __init free_unused_memmap(struct meminfo *mi) · line 506

Quoted 5 lines
arch/arm/mm/init.c +4 -0
+		 * memmap entries are valid from the bank start aligned to
+		 * MAX_ORDER_NR_PAGES.
+		 */
+		bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
  #endif

We ran into this bug on 2.6.38 and I had similar fix. Are you sure this doesn't apply SPARSEMEM configurations? At first glance, it seems like there could be an issue there as well.

Thanks,
Mike

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum