From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx198.postini.com [74.125.245.198]) by kanga.kvack.org (Postfix) with SMTP id BA1BA6B0039 for ; Thu, 15 Aug 2013 04:43:59 -0400 (EDT) Message-ID: <520C947B.40407@cn.fujitsu.com> Date: Thu, 15 Aug 2013 16:42:35 +0800 From: Tang Chen MIME-Version: 1.0 Subject: Re: [PATCH part5 0/7] Arrange hotpluggable memory as ZONE_MOVABLE. References: <1375956979-31877-1-git-send-email-tangchen@cn.fujitsu.com> <20130812145016.GI15892@htj.dyndns.org> <5208FBBC.2080304@zytor.com> <20130812152343.GK15892@htj.dyndns.org> <52090D7F.6060600@gmail.com> <20130812164650.GN15892@htj.dyndns.org> <5209CEC1.8070908@cn.fujitsu.com> <520A02DE.1010908@cn.fujitsu.com> In-Reply-To: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Sender: owner-linux-mm@kvack.org List-ID: To: Yinghai Lu Cc: Tejun Heo , Tang Chen , "H. Peter Anvin" , Bob Moore , Lv Zheng , "Rafael J. Wysocki" , Len Brown , Thomas Gleixner , Ingo Molnar , Andrew Morton , Thomas Renninger , Jiang Liu , Wen Congyang , Lai Jiangshan , Yasuaki Ishimatsu , Taku Izumi , Mel Gorman , Minchan Kim , "mina86@mina86.com" , "gong.chen@linux.intel.com" , Vasilis Liaskovitis , "lwoodman@redhat.com" , Rik van Riel , "jweiner@redhat.com" , Prarit Bhargava , Zhang Yanfei , "yanghy@cn.fujitsu.com" , the arch/x86 maintainers , "linux-doc@vger.kernel.org" , Linux Kernel Mailing List , Linux MM , ACPI Devel Maling List , "Luck, Tony (tony.luck@intel.com)" On 08/14/2013 06:33 AM, Yinghai Lu wrote: ...... > >> init_mem_mapping() > > Now we top and down, so initial page tables in in BRK, other page tables > is near the top! Hi yinghai, tj, About the page table, the current logic is to use BRK to map the highest range of memory. And then, use the mapped range to map the rest ranges, downwards. In alloc_low_pages(): 57 ret = memblock_find_in_range(min_pfn_mapped << PAGE_SHIFT, 58 max_pfn_mapped << PAGE_SHIFT, 59 PAGE_SIZE * num , PAGE_SIZE); ...... 63 pfn = ret >> PAGE_SHIFT; ...... 78 return __va(pfn << PAGE_SHIFT); So if we want to allocate page tables near the kernelimage, we have to do the following: 1. Use BRK to map a range near kernel image, let's call it range X. 2. Calculate how much memory needed to map all the memory, let's say Y Bytes. Use range X to map at least Y Bytes memory near kernel image. 3. Use the mapped memory to map all the rest memory. Does this sound OK to you guys ? Thanks. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org