Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162070AbbKTIRp (ORCPT ); Fri, 20 Nov 2015 03:17:45 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:5723 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161303AbbKTIRl (ORCPT ); Fri, 20 Nov 2015 03:17:41 -0500 Message-ID: <564ED708.5090405@huawei.com> Date: Fri, 20 Nov 2015 16:17:12 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrew Morton , Tang Chen , zhong jiang , Minchan Kim , Mel Gorman CC: Linux MM , LKML Subject: [RFC] mm: direct mapping count in /proc/meminfo is error Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.564ED71D.0044,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9df4e2ad843afb118e9300813a738bd1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2398 Lines: 54 I find the direct mapping count in /proc/meminfo is error. The value should be equal to the size of init_memory_mapping which showed in boot log. I add some print to show direct_pages_count[] immediately after init_memory_mapping(). The reason is that we double counting. Here is the log(kernel v4.4): ... [ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff] // called from "init_memory_mapping(0, ISA_END_ADDRESS);" [ 0.000000] [mem 0x00000000-0x000fffff] page 4k [ 0.000000] BRK [0x01ebf000, 0x01ebffff] PGTABLE [ 0.000000] BRK [0x01ec0000, 0x01ec0fff] PGTABLE [ 0.000000] BRK [0x01ec1000, 0x01ec1fff] PGTABLE [ 0.000000] init_memory_mapping: [mem 0xc3fe00000-0xc3fffffff] // called from "memory_map_top_down(ISA_END_ADDRESS, end);" [ 0.000000] [mem 0xc3fe00000-0xc3fffffff] page 1G // increase count of PG_LEVEL_1G in c00000000(48G)-c3fffffff(49G) one time [ 0.000000] init_memory_mapping: [mem 0xc20000000-0xc3fdfffff] [ 0.000000] [mem 0xc20000000-0xc3fdfffff] page 1G // increase count of PG_LEVEL_1G in c00000000(48G)-c3fffffff(49G) two time [ 0.000000] init_memory_mapping: [mem 0x00100000-0xbf78ffff] [ 0.000000] [mem 0x00100000-0x001fffff] page 4k [ 0.000000] [mem 0x00200000-0x3fffffff] page 2M [ 0.000000] [mem 0x40000000-0x7fffffff] page 1G [ 0.000000] [mem 0x80000000-0xbf5fffff] page 2M [ 0.000000] [mem 0xbf600000-0xbf78ffff] page 4k [ 0.000000] init_memory_mapping: [mem 0x100000000-0xc1fffffff] [ 0.000000] [mem 0x100000000-0xc1fffffff] page 1G // increase count of PG_LEVEL_1G in c00000000(48G)-c3fffffff(49G) three time ... [ 0.000000] DirectMap4k: 3648 kB [ 0.000000] DirectMap2M: 2084864 kB [ 0.000000] DirectMap1G: 50331648 kB euler-linux:~ # cat /proc/meminfo | grep DirectMap DirectMap4k: 91712 kB DirectMap2M: 4093952 kB DirectMap1G: 48234496 kB total DirectMap is 48234496 + 4093952 + 91712 = 52420160kb 50331648 + 2084864 + 3648 = 52420160kb total init_memory_mapping is 50323008kb 52420160kb - 50323008kb = 2097152kb = 2G However I haven't find a better way to fix it, any ideas? Thanks, Xishi Qiu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/