From: Pavel Machek <pavel@suse.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: LKML <linux-kernel@vger.kernel.org>,
hugang@soulinfo.com, Nigel Cunningham <ncunningham@linuxmail.org>
Subject: Re: [RFC][PATCH] swsusp: do not use higher order memory allocations on suspend
Date: Fri, 28 Jan 2005 18:24:51 +0100 [thread overview]
Message-ID: <20050128172451.GD7551@elf.ucw.cz> (raw)
In-Reply-To: <200501281454.23167.rjw@sisk.pl>
Hi!
> The following patch is (yet) an(other) attempt to eliminate the need for using higher
> order memory allocations on suspend. It accomplishes this by replacing the array
> of page backup entries with a list, so it is only necessary to allocate individual
> memory pages.
>
> I have noticed that the suspend code in swsusp is actually independent of the
> resume code and vice versa, so it is not necessary to change them
> both at once.
:-) Heh, nice idea, but it is going to be really confusing to anyone
reading the code in between.
> Therefore I have decided, for now, to only modify the suspend part which is more
> straightforward. The resume code is almost unaffected by this patch (the only
> thing changed in this code is a BUG_ON() that is removed).
>
> The patch is against 2.6.11-rc2. It has been tested and quite thoroughly debugged
> on x86-64. Still, if anyone could test it on another architecture, I'd be grateful.
> Of course comments, suggestions etc. are welcome.
I'll do some testing later.
> diff -Nru linux-2.6.11-rc2-orig/include/linux/suspend.h linux-2.6.11-rc2/include/linux/suspend.h
> --- linux-2.6.11-rc2-orig/include/linux/suspend.h 2005-01-28 14:23:42.000000000 +0100
> +++ linux-2.6.11-rc2/include/linux/suspend.h 2005-01-28 13:53:36.000000000 +0100
> @@ -16,11 +16,20 @@
> unsigned long address; /* address of the copy */
> unsigned long orig_address; /* original address of page */
> swp_entry_t swap_address;
> - swp_entry_t dummy; /* we need scratch space at
> - * end of page (see link, diskpage)
> - */
> +
> + struct pbe *next;
It is still used as a scratch space at end of page, please leave the
comment.
> printk( "Writing data to swap (%d pages)... ", nr_copy_pages );
> - for (i = 0; i < nr_copy_pages && !error; i++) {
> + for_each_pbe(p, pagedir_nosave) {
> if (!(i%mod))
> printk( "\b\b\b\b%3d%%", i / mod );
> - error = write_page((pagedir_nosave+i)->address,
> - &((pagedir_nosave+i)->swap_address));
> + error = write_page(p->address, &(p->swap_address));
> + if (error)
> + goto Exit;
Can you do return error instead? Goto is ugly. Or just break. Same in
next chunks.
>
> -
> -static void calc_order(void)
> +static int calc_nr(int nr_copy)
> {
> - int diff = 0;
> - int order = 0;
> + int extra = 0;
> + int mod = (nr_copy % PBES_PER_PAGE) ? 1 : 0;
!!( ) is usually used for this.
> + int diff = (nr_copy / PBES_PER_PAGE) + mod;
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
next prev parent reply other threads:[~2005-01-28 17:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-28 13:54 [RFC][PATCH] swsusp: do not use higher order memory allocations on suspend Rafael J. Wysocki
2005-01-28 14:07 ` Martin Zwickel
2005-01-28 17:52 ` Rafael J. Wysocki
2005-01-28 17:24 ` Pavel Machek [this message]
2005-01-28 18:31 ` Rafael J. Wysocki
[not found] ` <200501300052.55545.rjw@sisk.pl>
[not found] ` <20050131130631.GF6279@elf.ucw.cz>
[not found] ` <200501311510.12979.rjw@sisk.pl>
2005-01-31 18:20 ` Pavel Machek
2005-01-31 18:52 ` Rafael J. Wysocki
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=20050128172451.GD7551@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=hugang@soulinfo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ncunningham@linuxmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.