lkml.org 
[lkml]   [2003]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Software suspend testing in 2.6.0-test1
From
Date
Pavel Machek <pavel@ucw.cz> writes:

> > However I'm trying to remember why the code exists at all. Why doesn't
> > swsusp just allocate lots of pages then free them again?
>
> Because that either
>
> a) does not free enough pages or
>
> b) triggers OOM killer.
>
> It was actually your idea, IIRC ;-).
>
> Ahha, you seem to be addressing that in your code. Peter, perhaps you
> want to test that one?

I tried the patch below, but it didn't work. Nothing (or very little)
was swapped out to disk. I also tried using GFP_KERNEL, but that
seemed to cause a deadlock. (Maybe it would have gone OOM if I had
waited long enough). I think the problem is that pdflush and friends
are already frozen when this code runs.

--- linux/kernel/suspend.c.old Fri Jul 18 15:46:48 2003
+++ linux/kernel/suspend.c Fri Jul 18 15:45:51 2003
@@ -621,10 +621,32 @@
*/
static void free_some_memory(void)
{
- printk("Freeing memory: ");
- while (shrink_all_memory(10000))
- printk(".");
+ LIST_HEAD(list);
+ struct page *page, *tmp;
+ int sleep_count = 0;
+ int i = 0;
+
+ while (sleep_count < 10) {
+ page = alloc_page(GFP_ATOMIC);
+ if (page) {
+ list_add(&page->list, &list);
+ sleep_count = 0;
+ } else {
+ blk_congestion_wait(WRITE, HZ/20);
+ sleep_count++;
+ }
+ i++;
+ if (!(i%1000))
+ printk(".");
+ }
printk("|\n");
+
+ i = 0;
+ list_for_each_entry_safe(page, tmp, &list, list) {
+ __free_page(page);
+ i++;
+ }
+ printk("%d pages freed\n", i);
}

/* Make disk drivers accept operations, again */
--
Peter Osterlund - petero2@telia.com
http://w1.894.telia.com/~u89404340
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.068 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site