Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262671AbVAKBIc (ORCPT ); Mon, 10 Jan 2005 20:08:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262686AbVAKBGx (ORCPT ); Mon, 10 Jan 2005 20:06:53 -0500 Received: from hell.sks3.muni.cz ([147.251.210.30]:56813 "EHLO hell.sks3.muni.cz") by vger.kernel.org with ESMTP id S262703AbVAKBBZ (ORCPT ); Mon, 10 Jan 2005 20:01:25 -0500 Date: Tue, 11 Jan 2005 02:01:23 +0100 From: Lukas Hejtmanek To: linux-kernel@vger.kernel.org Subject: PATCH swsusp: page rellocation speed up Message-ID: <20050111010122.GA3013@mail.muni.cz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline Content-Transfer-Encoding: 8bit X-echelon: NSA, CIA, CI5, MI5, FBI, KGB, BIS, Plutonium, Bin Laden, bomb User-Agent: Mutt/1.5.6+20040907i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2751 Lines: 102 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, attached patch should speed up page rellocation at time of resume. Please test. The diff is against 2.6.10-bk8 -- Luk?? Hejtm?nek --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename=patch --- a/kernel/power/swsusp.c 2005-01-06 14:08:33.000000000 +0100 +++ b/kernel/power/swsusp.c 2005-01-11 01:03:24.000000000 +0100 @@ -885,25 +885,18 @@ } - /* More restore stuff */ -#define does_collide(addr) does_collide_order(pagedir_nosave, addr, 0) - /* * Returns true if given address/order collides with any orig_address */ -static int __init does_collide_order(suspend_pagedir_t *pagedir, unsigned long addr, - int order) +static int __init does_collide_order(unsigned long addr, int order) { int i; - unsigned long addre = addr + (PAGE_SIZE<orig_address >= addr && - (pagedir+i)->orig_address < addre) + for (i=0; i < (1<address = addr; } @@ -939,16 +932,34 @@ void **eaten_memory = NULL; void **c = eaten_memory, *m, *f; int ret = 0; + struct zone *zone; + int i; + struct pbe *p; + unsigned long zone_pfn; printk("Relocating pagedir "); - if (!does_collide_order(old_pagedir, (unsigned long)old_pagedir, pagedir_order)) { + /* Set page flags */ + + for_each_zone(zone) { + for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) + SetPageNosaveFree(pfn_to_page(zone_pfn + + zone->zone_start_pfn)); + } + + /* Clear orig address */ + + for(i = 0, p = pagedir_nosave; i < nr_copy_pages; i++, p++) { + ClearPageNosaveFree(virt_to_page(p->orig_address)); + } + + if (!does_collide_order((unsigned long)old_pagedir, pagedir_order)) { printk("not necessary\n"); return check_pagedir(); } while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order)) != NULL) { - if (!does_collide_order(old_pagedir, (unsigned long)m, pagedir_order)) + if (!does_collide_order((unsigned long)m, pagedir_order)) break; eaten_memory = m; printk( "." ); --ikeVEW9yuYc//A+q-- - 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/