Skip to contentSkip to conversation

makedumpfile: fix bug on is_sparsemem_extreme

PATCH In review Liu Hua 2 participants 2 messages May 7, 2014

Subsystems (2)
lore
Share & tools
lore

Liu Hua

author
#0 lore raw

PATCH 1/1 makedumpfile: fix bug on is_sparsemem_extreme

The kernel gets the length of mem_section use this
from: include/linux/mmzone.h:1134

"#define NR_SECTION_ROOTS DIV_ROUND_UP(NR_MEM_SECTIONS,
SECTIONS_PER_ROOT)"

But when we check the memory model. We forget the
"DIV_ROUND_UP" method.

So when 32-bit ARM linux is in sparsemem_extreme memory:
with SECTION_SIZE_BIT=28 and 16 byte-size mem_section.
The makedumpfile can not identify the memory correctly.

This patch introduce the "DIV_ROUND_UP" method in this check.

---
 makedumpfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
makedumpfile.c +1 -1
index 0b31932..16081a5 100644
@@ -1599,7 +1599,7 @@ int
 is_sparsemem_extreme(void)
 {
 	if (ARRAY_LENGTH(mem_section)
-	     == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
+	     == divideup(NR_MEM_SECTIONS(), _SECTIONS_PER_ROOT_EXTREME()))
 		return TRUE;
 	else
 		return FALSE;
Signature · 7 lines
1.9.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 6 lines

The kernel gets the length of mem_section use this
from: include/linux/mmzone.h:1134

"#define NR_SECTION_ROOTS DIV_ROUND_UP(NR_MEM_SECTIONS,
SECTIONS_PER_ROOT)"

Quoted 8 lines

But when we check the memory model. We forget the
"DIV_ROUND_UP" method.

So when 32-bit ARM linux is in sparsemem_extreme memory:
with SECTION_SIZE_BIT=28 and 16 byte-size mem_section. The makedumpfile can not identify the memory correctly.

This patch introduce the "DIV_ROUND_UP" method in this check.

Thanks, I'll merge this patch into v1.5.7.

Atsushi Kumagai

Quoted 19 lines

---
makedumpfile.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
makedumpfile.c +1 -2
index 0b31932..16081a5 100644
@@ -1599,7 +1599,7 @@ int
 is_sparsemem_extreme(void)
 {
 	if (ARRAY_LENGTH(mem_section)
-	     == (NR_MEM_SECTIONS() / _SECTIONS_PER_ROOT_EXTREME()))
+	     == divideup(NR_MEM_SECTIONS(), _SECTIONS_PER_ROOT_EXTREME()))
 		return TRUE;
 	else
 		return FALSE;
--
Quoted 1 line

1.9.0

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec