From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail190.messagelabs.com (mail190.messagelabs.com [216.82.249.51]) by kanga.kvack.org (Postfix) with SMTP id 5A6856B004D for ; Tue, 18 Aug 2009 04:49:45 -0400 (EDT) Message-ID: <4A8A6B8F.7000604@redhat.com> Date: Tue, 18 Aug 2009 16:51:27 +0800 From: Amerigo Wang MIME-Version: 1.0 Subject: Re: [Patch 8/8] kexec: allow to shrink reserved memory References: <20090812081731.5757.25254.sendpatchset@localhost.localdomain> <20090812081906.5757.39417.sendpatchset@localhost.localdomain> <4A83893D.50707@redhat.com> <4A83CD84.8040609@redhat.com> <4A8927DD.6060209@redhat.com> <20090818092939.2efbe158.kamezawa.hiroyu@jp.fujitsu.com> <4A8A4ABB.70003@redhat.com> <20090818172552.779d0768.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20090818172552.779d0768.kamezawa.hiroyu@jp.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: KAMEZAWA Hiroyuki Cc: "Eric W. Biederman" , linux-kernel@vger.kernel.org, tony.luck@intel.com, linux-ia64@vger.kernel.org, linux-mm@kvack.org, Neil Horman , Andi Kleen , akpm@linux-foundation.org, bernhard.walle@gmx.de, Fenghua Yu , Ingo Molnar , Anton Vorontsov List-ID: KAMEZAWA Hiroyuki wrote: > On Tue, 18 Aug 2009 14:31:23 +0800 > Amerigo Wang wrote: > >> Hi, thank you! >> >>> Can I have a question ? >>> >>> - How crash kernel's memory is preserved at boot ? >>> >>> >> Use bootmem, I think. >> >> > I see. > > In x86, > > setup_arch() > -> reserve_crashkernel() > -> find_and_reserve_crashkernel() > -> reserve_bootmem_generic() > > Then, all "active range" is already registered and there are memmap. > > > >>> It's hidden from the system before mem_init() ? >>> >>> >> Not sure, but probably yes. It is reserved in setup_arch() which is >> before mm_init() which calls mem_init(). >> >> Do you have any advice to free that reserved memory after boot? :) >> >> > > Let's see arch/x86/mm/init.c::free_initmem() > > Maybe it's all you want. > > - ClearPageReserved() > - init_page_count() > - free_page() > - totalram_pages++ > > But it has no argumetns. Maybe you need your own function or modification. > online_pages() does very similar. But, hmm,.. writing something open coded one > for crashkernel is not very bad, I think. > Nice help! Yeah, I think we can make that be a generic wrapper function so that both free_initmem() and shrink_crash_memory() can use it. Then I will update and resend the whole patchset. Thank you! -- 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