From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Con Kolivas <kernel@kolivas.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
linux list <linux-kernel@vger.kernel.org>,
ck list <ck@vds.kolivas.org>, Andrew Morton <akpm@osdl.org>,
Pavel Machek <pavel@ucw.cz>,
linux-mm@kvack.org
Subject: Re: [PATCH][1/3] mm: swsusp shrink_all_memory tweaks
Date: Mon, 20 Mar 2006 19:46:31 +0100 [thread overview]
Message-ID: <200603201946.32681.rjw@sisk.pl> (raw)
In-Reply-To: <200603202250.14843.kernel@kolivas.org>
On Monday 20 March 2006 12:50, Con Kolivas wrote:
> On Monday 20 March 2006 22:41, Nick Piggin wrote:
> > I still don't like this change.
>
> Fine.
>
> Respin.
}-- snip --{
> Index: linux-2.6.16-rc6-mm2/kernel/power/swsusp.c
> ===================================================================
> --- linux-2.6.16-rc6-mm2.orig/kernel/power/swsusp.c 2006-03-20 22:44:10.000000000 +1100
> +++ linux-2.6.16-rc6-mm2/kernel/power/swsusp.c 2006-03-20 22:46:12.000000000 +1100
> @@ -173,9 +173,6 @@ void free_all_swap_pages(int swap, struc
> * Notice: all userland should be stopped before it is called, or
> * livelock is possible.
> */
> -
> -#define SHRINK_BITE 10000
> -
> int swsusp_shrink_memory(void)
> {
> long size, tmp;
> @@ -194,14 +191,13 @@ int swsusp_shrink_memory(void)
> for_each_zone (zone)
> if (!is_highmem(zone))
> tmp -= zone->free_pages;
> + if (tmp <= 0)
> + tmp = size - image_size / PAGE_SIZE;
> if (tmp > 0) {
> - tmp = shrink_all_memory(SHRINK_BITE);
> + tmp = shrink_all_memory(tmp);
> if (!tmp)
> return -ENOMEM;
> pages += tmp;
> - } else if (size > image_size / PAGE_SIZE) {
> - tmp = shrink_all_memory(SHRINK_BITE);
> - pages += tmp;
> }
> printk("\b%c", p[i++%4]);
> } while (tmp > 0);
>
swsusp_shrink_memory() is still wrong, because it will always fail for
image_size = 0. My bad, sorry.
The appended patch (on top of yours) should fix that (hope I did it right
this time).
kernel/power/swsusp.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6.16-rc6-mm2/kernel/power/swsusp.c
===================================================================
--- linux-2.6.16-rc6-mm2.orig/kernel/power/swsusp.c
+++ linux-2.6.16-rc6-mm2/kernel/power/swsusp.c
@@ -192,13 +192,17 @@ int swsusp_shrink_memory(void)
for_each_zone (zone)
if (!is_highmem(zone))
tmp -= zone->free_pages;
- if (tmp <= 0)
- tmp = size - image_size / PAGE_SIZE;
if (tmp > 0) {
tmp = shrink_all_memory(tmp);
if (!tmp)
return -ENOMEM;
pages += tmp;
+ } else {
+ size -= image_size / PAGE_SIZE;
+ if (size > 0) {
+ tmp = shrink_all_memory(size);
+ pages += tmp;
+ }
}
printk("\b%c", p[i++%4]);
} while (tmp > 0);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-03-20 18:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 15:31 Con Kolivas
2006-03-20 11:41 ` Nick Piggin
2006-03-20 11:50 ` Con Kolivas
2006-03-20 18:46 ` Rafael J. Wysocki [this message]
2006-03-24 7:07 ` [PATCH] " Con Kolivas
2006-03-24 15:16 ` Rafael J. Wysocki
2006-03-24 15:30 ` Con Kolivas
2006-03-24 16:14 ` Rafael J. Wysocki
2006-03-30 17:12 ` Rafael J. Wysocki
2006-03-30 18:37 ` Rafael J. Wysocki
2006-03-30 20:38 ` Con Kolivas
2006-03-30 20:57 ` Rafael J. Wysocki
2006-03-27 12:24 ` Pavel Machek
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=200603201946.32681.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=akpm@osdl.org \
--cc=ck@vds.kolivas.org \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=pavel@ucw.cz \
/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