Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966127AbXLTPjx (ORCPT ); Thu, 20 Dec 2007 10:39:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933396AbXLTPWg (ORCPT ); Thu, 20 Dec 2007 10:22:36 -0500 Received: from mtagate2.de.ibm.com ([195.212.29.151]:35050 "EHLO mtagate2.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933375AbXLTPVK (ORCPT ); Thu, 20 Dec 2007 10:21:10 -0500 Message-Id: <20071220152108.129681973@de.ibm.com> References: <20071220151925.405881218@de.ibm.com> User-Agent: quilt/0.46-1 Date: Thu, 20 Dec 2007 16:19:48 +0100 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Heiko Carstens , Martin Schwidefsky Subject: [patch 23/47] Get rid of HOLES_IN_ZONE requirement. Content-Disposition: inline; filename=122-zone-holes.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3040 Lines: 95 From: Heiko Carstens Align everything to MAX_ORDER so we can get rid of the extra checks. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/Kconfig | 3 --- arch/s390/kernel/setup.c | 25 ++++++++++++++++++++++++- arch/s390/mm/vmem.c | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) Index: quilt-2.6/arch/s390/Kconfig =================================================================== --- quilt-2.6.orig/arch/s390/Kconfig +++ quilt-2.6/arch/s390/Kconfig @@ -276,9 +276,6 @@ source "kernel/Kconfig.preempt" source "mm/Kconfig" -config HOLES_IN_ZONE - def_bool y - comment "I/O subsystem configuration" config MACHCHK_WARNING Index: quilt-2.6/arch/s390/kernel/setup.c =================================================================== --- quilt-2.6.orig/arch/s390/kernel/setup.c +++ quilt-2.6/arch/s390/kernel/setup.c @@ -559,7 +559,9 @@ setup_resources(void) data_resource.start = (unsigned long) &_etext; data_resource.end = (unsigned long) &_edata - 1; - for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { + for (i = 0; i < MEMORY_CHUNKS; i++) { + if (!memory_chunk[i].size) + continue; res = alloc_bootmem_low(sizeof(struct resource)); res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; switch (memory_chunk[i].type) { @@ -630,6 +632,27 @@ static void __init setup_memory_end(void max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START; memory_end = min(max_mem, memory_end); + /* + * Make sure all chunks are MAX_ORDER aligned so we don't need the + * extra checks that HOLES_IN_ZONE would require. + */ + for (i = 0; i < MEMORY_CHUNKS; i++) { + unsigned long start, end; + struct mem_chunk *chunk; + unsigned long align; + + chunk = &memory_chunk[i]; + align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1); + start = (chunk->addr + align - 1) & ~(align - 1); + end = (chunk->addr + chunk->size) & ~(align - 1); + if (start >= end) + memset(chunk, 0, sizeof(*chunk)); + else { + chunk->addr = start; + chunk->size = end - start; + } + } + for (i = 0; i < MEMORY_CHUNKS; i++) { struct mem_chunk *chunk = &memory_chunk[i]; Index: quilt-2.6/arch/s390/mm/vmem.c =================================================================== --- quilt-2.6.orig/arch/s390/mm/vmem.c +++ quilt-2.6/arch/s390/mm/vmem.c @@ -376,7 +376,7 @@ static int __init vmem_convert_memory_ch int i; mutex_lock(&vmem_mutex); - for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { + for (i = 0; i < MEMORY_CHUNKS; i++) { if (!memory_chunk[i].size) continue; seg = kzalloc(sizeof(*seg), GFP_KERNEL); -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- 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/