mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: hugang@soulinfo.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Software Suspend split to two stage V2.
Date: Sat, 20 Nov 2004 01:15:25 +0100	[thread overview]
Message-ID: <20041120001525.GF1594@elf.ucw.cz> (raw)
In-Reply-To: <20041119194007.GA1650@hugang.soulinfo.com>

Hi!

>   This patch using pagemap for PageSet2 bitmap, It increase suspend
>   speed, In my PowerPC suspend only need 5 secs, cool. 

Well, speed is nice but... I have O(n^2) => O(n) patch in my tree that
provides some nice speedup too, and is less invasive. They are
probably orthogonal.

* you'll have to explain (in Documentation/power/swsusp.txt) why this
is safe. Normal swsusp is safe because interrupts&DMAs are
disabled. You are doing writes but data in page-cache may not be
modified, right? What are exact requirements for this and how it is
guaranteed that data are indeed not modified?

* what is pcs_ prefix? Page Cache Suspend?

(ouch and be warned that this will take quite long to get
in. There are patches in my queue I'd like to get in first, like
O(n^2) => O(n) page marking).

> +static void calc_order(int *po, int *nr)
> +{

"po" is bad name even for local variable.

> +static unsigned long *pageset2map = NULL;
> +
> +#define PAGENUMBER(page) (page-mem_map)
> +#define PAGEINDEX(page) ((PAGENUMBER(page))/(8*sizeof(unsigned long)))
> +#define PAGEBIT(page) ((int) ((PAGENUMBER(page))%(8 * sizeof(unsigned long))))
> +
> +#define BITS_PER_PAGE (PAGE_SIZE * 8)
> +#define PAGES_PER_BITMAP ((max_mapnr + BITS_PER_PAGE - 1) / BITS_PER_PAGE)
> +#define BITMAP_ORDER (get_bitmask_order((PAGES_PER_BITMAP) - 1))

> +#define PagePageset2(page) \
> +	test_bit(PAGEBIT(page), &pageset2map[PAGEINDEX(page)])
> +#define SetPagePageset2(page) \
> +	set_bit(PAGEBIT(page), &pageset2map[PAGEINDEX(page)])

Can't you just get another bit in page.h to avoid these arrays?

> +static int pcs_write(void)
> +{
> +	int error = 0;
> +	int i;
> +
> +	printk( "Writing PageCaches to swap (%d pages): ", nr_copy_pcs);
> +	for (i = 0; i < nr_copy_pcs && !error; i++) {
> +		if (!(i%100))
> +			printk( "." );

Please take % progress from newer swsusp.

> +static void count_data_pages(void);
> +static int swsusp_alloc(void);
> +
> +int pcs_suspend(int resume)
> +{
> +	struct zone *zone;
> +	suspend_pagedir_t *pe = NULL;
> +	int error;
> +
> +	if (resume == 1) {
> +		return (0);
> +	}
> +	if (resume == 2) {
> +		pcs_read();
> +		pcs_free_pagemap();
> +		return (0);
> +	}

I'd understand int resume taking 0 and 1, but what does 2 mean? Also
use return 0; not return (0);

								Pavel
-- 
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:[~2004-11-20  5:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-19 19:40 hugang
2004-11-20  0:15 ` Pavel Machek [this message]
2004-11-20  0:30 ` swsusp bigdiff [was Re: [PATCH] Software Suspend split to two stage V2.] Pavel Machek
2004-11-20  3:03   ` hugang
2004-11-20 10:15     ` Pavel Machek
2004-11-20  8:12   ` hugang
2004-11-20 21:22     ` Pavel Machek
2004-11-20 21:41     ` Pavel Machek
2004-11-20 22:35     ` Pavel Machek
2004-11-20 22:49     ` Pavel Machek
2004-11-21  7:48       ` hugang
2004-11-22  7:22       ` hugang
2004-11-22 10:26         ` Pavel Machek
2004-11-22 10:32           ` hugang
2004-11-22 11:02             ` Pavel Machek
2004-11-22 11:54               ` Rafael J. Wysocki
2004-11-22 21:50                 ` Nigel Cunningham
2004-11-23 21:54                   ` Pavel Machek
2004-11-23 21:57                     ` Nigel Cunningham
2004-11-24  8:03                     ` [PATH] 11-24 swsusp update 2/3 hugang
2004-11-24  8:04                     ` [PATH] 11-24 swsusp update 3/3 hugang
2004-11-24  9:13                       ` hugang
2004-11-24 14:05                       ` Colin Leroy
2004-11-22 16:58               ` [PATH] swsusp update 1/3 hugang
2004-11-23 22:14                 ` Pavel Machek
2004-11-24  8:02                   ` [PATH] 11-24 " hugang
2004-11-24 10:56                     ` Pavel Machek
2004-11-24 11:28                   ` [PATH] " Pavel Machek
2004-11-24 18:30                     ` hugang
2004-12-20 21:45                       ` Nishanth Aravamudan
2004-12-20 22:41                         ` Pavel Machek
2004-11-22 16:58               ` [PATH] swsusp update 2/3 hugang
2004-11-23 22:23                 ` Pavel Machek
2004-11-22 16:58               ` [PATH] swsusp update 3/3 hugang
2004-11-23 22:29                 ` Pavel Machek
2004-11-24 10:21                 ` Guido Guenther
2004-11-20  9:27   ` swsusp bigdiff [was Re: [PATCH] Software Suspend split to two stage V2.] hugang
2004-12-20 21:44   ` Nishanth Aravamudan
2004-12-20 22:40     ` Pavel Machek
2004-12-20 23:06     ` Zwane Mwaikambo
2004-12-20 23:28   ` Nigel Cunningham
2004-12-22 20:28     ` Pavel Machek
2004-12-22 21:21       ` Nigel Cunningham
2004-12-22 21:32         ` Pavel Machek
2004-12-23  0:52           ` Nigel Cunningham
2004-12-21 13:15   ` Paulo Marques

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=20041120001525.GF1594@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=hugang@soulinfo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®