public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: hugang@soulinfo.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.10-mm3: swsusp: out of memory on resume (was: Re: Ho ho ho - Linux v2.6.10)
Date: Sun, 16 Jan 2005 22:51:45 +0100	[thread overview]
Message-ID: <20050116215145.GF2757@elf.ucw.cz> (raw)
In-Reply-To: <200501152243.21483.rjw@sisk.pl>

Hi!

> > > > Has this patch been ported to x86_64?  Or is there a newer version of it anywhere,
> > > > or an alternative?
> > > > 
> > > 
> > > Ok, Here is a new patch with x86_64 support, But I have not machine, So
> > > Need someone test it. 
> > 
> > OK, I will.
> 
> I have tested it and it works well.  For me, it speeds up the resume process significantly,
> so I vote for including it into -mm (at least ;-)).  I'll be testing it further to see if it really
> solves my "out of memory" problems on resume.

Try Lukas's patch, it should provide equivalent speedups.
									Pavel

--- linux-cvs/kernel/power/swsusp.c	2005-01-16 22:29:25.000000000 +0100
+++ linux/kernel/power/swsusp.c	2005-01-16 22:49:10.000000000 +0100
@@ -893,26 +893,18 @@
 	return error;
 }
 
-
-
 /* 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<<order);
 	
-	for (i=0; i < nr_copy_pages; i++)
-		if ((pagedir+i)->orig_address >= addr &&
-			(pagedir+i)->orig_address < addre)
+	for (i=0; i < (1<<order); i++)
+		if (!PageNosaveFree(virt_to_page(addr + i * PAGE_SIZE)))
 			return 1;
-
 	return 0;
 }
 
@@ -931,7 +923,7 @@
 			addr = get_zeroed_page(GFP_ATOMIC);
 			if(!addr)
 				return -ENOMEM;
-		} while (does_collide(addr));
+		} while (does_collide_order(addr, 0));
 
 		(pagedir_nosave+i)->address = addr;
 	}
@@ -948,16 +940,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( "." ); 


-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

  reply	other threads:[~2005-01-16 21:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24 22:39 Ho ho ho - Linux v2.6.10 Linus Torvalds
2004-12-25 11:11 ` Andrew Walrond
2004-12-25 12:19 ` Alan Cox
2004-12-26 11:30   ` Wichert Akkerman
2004-12-26 13:45     ` R. J. Wysocki
2004-12-26 19:37       ` Pavel Machek
2004-12-26 19:39       ` Pavel Machek
2004-12-26 20:27         ` R. J. Wysocki
2004-12-26 22:10           ` Pavel Machek
2005-01-13 18:09             ` 2.6.10-mm3: swsusp: out of memory on resume (was: Re: Ho ho ho - Linux v2.6.10) Rafael J. Wysocki
2005-01-13 19:59               ` Pavel Machek
2005-01-13 21:22                 ` Rafael J. Wysocki
2005-01-14 14:34               ` hugang
2005-01-14 17:25                 ` Rafael J. Wysocki
2005-01-15 21:43                   ` Rafael J. Wysocki
2005-01-16 21:51                     ` Pavel Machek [this message]
2005-01-17 14:53                       ` Rafael J. Wysocki
2005-01-17 15:22                         ` Pavel Machek
2005-01-18  1:44                         ` hugang
     [not found]                 ` <200501150042.35377.rjw@sisk.pl>
2005-01-15  1:21                   ` hugang
     [not found]                     ` <200501151147.32919.rjw@sisk.pl>
     [not found]                       ` <200501152220.42129.rjw@sisk.pl>
2005-01-16  5:54                         ` hugang
2005-01-16 10:07                           ` Rafael J. Wysocki
2005-01-16 14:46                             ` hugang
2005-01-17 15:48                               ` Rafael J. Wysocki
2005-01-17 16:49                               ` Rafael J. Wysocki
2004-12-30  9:58         ` Ho ho ho - Linux v2.6.10 Rafael J. Wysocki
2004-12-26 15:45   ` Alan Cox
2004-12-29 12:44   ` Paolo Ciarrocchi
2004-12-26  2:55 ` Bill Davidsen
2004-12-26  3:36   ` Linus Torvalds
     [not found]   ` <1104171962.18174.28.camel@d845pe>
2004-12-28 16:38     ` Ho ho ho - Linux v2.6.10 (irq18) Bill Davidsen
2004-12-26  4:19 ` Ho ho ho - Linux v2.6.10 Alexander E. Patrakov
2004-12-26  5:12   ` [PATCH] parport_pc: don't mix module parameter styles Randy.Dunlap
2004-12-26 20:35 ` Ho ho ho - Linux v2.6.10 Greg Norris
2004-12-27  1:31   ` Dmitry Torokhov
2004-12-28  2:36     ` Greg Norris
2004-12-27 16:10 ` Ho ho ho - Linux v2.6.10 (compile stats) John Cherry
2004-12-28  1:04 ` Ho ho ho - Linux v2.6.10 Håkan Lindqvist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050116215145.GF2757@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=hugang@soulinfo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox