Return-path: Received: from szxga02-in.huawei.com ([119.145.14.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Whr1Z-0000zD-NB for kexec@lists.infradead.org; Wed, 07 May 2014 01:51:58 +0000 From: Liu Hua Subject: [PATCH] makedumpfile: fix bug on is_sparsemem_extreme Date: Wed, 7 May 2014 09:43:36 +0800 Message-ID: <1399427016-54289-1-git-send-email-sdu.liu@huawei.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: kumagai-atsushi@mxc.nes.nec.co.jp, chaowang@redhat.com Cc: wangnan0@huawei.com, kexec@lists.infradead.org, peifeiyue@huawei.com, Liu Hua 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 --- 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 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec