From: "Jan Beulich" Subject: [PATCH] x86-64 linux: cleanup use of reserve_bootmem_generic() Date: Fri, 05 May 2006 13:36:19 +0200 Message-ID: <445B54D3.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartECC9FEA3.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartECC9FEA3.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Make reserve_bootmem_generic() an empty inline function, thus allowing to reduce the amount of changes needed elsewhere. At once, this recovers two pages needlessly getting reserved on SMP. Signed-off-by: Jan Beulich --=__PartECC9FEA3.0__= Content-Type: text/plain; name="xenlinux-x86_64-reserve_bootmem_generic.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xenlinux-x86_64-reserve_bootmem_generic.patch" Index: head-2006-05-03/arch/x86_64/kernel/setup-xen.c =================================================================== --- head-2006-05-03.orig/arch/x86_64/kernel/setup-xen.c 2006-05-05 12:05:55.000000000 +0200 +++ head-2006-05-03/arch/x86_64/kernel/setup-xen.c 2006-05-05 12:09:01.000000000 +0200 @@ -616,10 +616,10 @@ static inline void copy_edd(void) } #endif -#ifndef CONFIG_XEN #define EBDA_ADDR_POINTER 0x40E static void __init reserve_ebda_region(void) { +#ifndef CONFIG_XEN unsigned int addr; /** * there is a real-mode segmented pointer pointing to the @@ -629,8 +629,8 @@ static void __init reserve_ebda_region(v addr <<= 4; if (addr) reserve_bootmem_generic(addr, PAGE_SIZE); -} #endif +} void __init setup_arch(char **cmdline_p) { @@ -740,7 +740,6 @@ void __init setup_arch(char **cmdline_p) contig_initmem_init(start_pfn, end_pfn); #endif -#ifndef CONFIG_XEN /* Reserve direct mapping */ reserve_bootmem_generic(table_start << PAGE_SHIFT, (table_end - table_start) << PAGE_SHIFT); @@ -757,7 +756,6 @@ void __init setup_arch(char **cmdline_p) /* reserve ebda region */ reserve_ebda_region(); -#endif #ifdef CONFIG_SMP /* @@ -777,31 +775,20 @@ void __init setup_arch(char **cmdline_p) */ acpi_reserve_bootmem(); #endif -#ifdef CONFIG_XEN #ifdef CONFIG_BLK_DEV_INITRD +#ifndef CONFIG_XEN + if (LOADER_TYPE && INITRD_START) { +#else if (xen_start_info->mod_start) { - if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { - /*reserve_bootmem_generic(INITRD_START, INITRD_SIZE);*/ - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start+INITRD_SIZE; - initrd_below_start_ok = 1; - } else { - printk(KERN_ERR "initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - (unsigned long)(INITRD_START + INITRD_SIZE), - (unsigned long)(end_pfn << PAGE_SHIFT)); - initrd_start = 0; - } - } #endif -#else /* CONFIG_XEN */ -#ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { reserve_bootmem_generic(INITRD_START, INITRD_SIZE); initrd_start = INITRD_START ? INITRD_START + PAGE_OFFSET : 0; initrd_end = initrd_start+INITRD_SIZE; +#ifdef CONFIG_XEN + initrd_below_start_ok = 1; +#endif } else { printk(KERN_ERR "initrd extends beyond end of memory " @@ -812,7 +799,6 @@ void __init setup_arch(char **cmdline_p) } } #endif -#endif /* !CONFIG_XEN */ #ifdef CONFIG_KEXEC if (crashk_res.start != crashk_res.end) { reserve_bootmem(crashk_res.start, Index: head-2006-05-03/arch/x86_64/mm/init-xen.c =================================================================== --- head-2006-05-03.orig/arch/x86_64/mm/init-xen.c 2006-05-03 09:36:02.000000000 +0200 +++ head-2006-05-03/arch/x86_64/mm/init-xen.c 2006-05-05 11:28:20.000000000 +0200 @@ -58,7 +58,9 @@ EXPORT_SYMBOL(dma_ops); extern unsigned long *contiguous_bitmap; +#ifndef CONFIG_XEN static unsigned long dma_reserve __initdata; +#endif DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); extern unsigned long start_pfn; @@ -985,6 +987,7 @@ void free_initrd_mem(unsigned long start } #endif +#ifndef CONFIG_XEN void __init reserve_bootmem_generic(unsigned long phys, unsigned len) { /* Should check here against the e820 map to avoid double free */ @@ -997,6 +1000,7 @@ void __init reserve_bootmem_generic(unsi if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) dma_reserve += len / PAGE_SIZE; } +#endif int kern_addr_valid(unsigned long addr) { Index: head-2006-05-03/include/asm-x86_64/proto.h =================================================================== --- head-2006-05-03.orig/include/asm-x86_64/proto.h 2006-03-20 06:53:29.000000000 +0100 +++ head-2006-05-03/include/asm-x86_64/proto.h 2006-05-05 11:44:17.000000000 +0200 @@ -67,8 +67,12 @@ extern int k8_scan_nodes(unsigned long s extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn); extern unsigned long numa_free_all_bootmem(void); +#ifndef CONFIG_XEN extern void reserve_bootmem_generic(unsigned long phys, unsigned len); extern void free_bootmem_generic(unsigned long phys, unsigned len); +#else +static inline void reserve_bootmem_generic(unsigned long phys, unsigned len) {} +#endif extern void load_gs_index(unsigned gs); --=__PartECC9FEA3.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartECC9FEA3.0__=--