[PATCH] makedumpfile: fix bug on is_sparsemem_extreme

Liu Hua sdu.liu at huawei.com
Tue May 6 18:43:36 PDT 2014


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.

Signed-off-by: Liu Hua <sdu.liu at huawei.com>
---
 makedumpfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 0b31932..16081a5 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -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;
-- 
1.9.0




More information about the kexec mailing list