Skip to contentSkip to conversation

SUSPEND_PD_PAGES-fix

PATCH Applied Coywolf Qi Hunt 5 participants 6 messages Mar 16, 2005 – Mar 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SUSPEND_PD_PAGES-fix

Hello,

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

Coywolf

include/linux/suspend.h +1 -1
diff -pruN 2.6.11-mm4/include/linux/suspend.h 2.6.11-mm4-cy/include/linux/suspend.h
@@ -34,7 +34,7 @@ typedef struct pbe {
 #define SWAP_FILENAME_MAXLENGTH	32
 
 
-#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
+#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe)+PAGE_SIZE-1)/PAGE_SIZE)
 
 extern dev_t swsusp_resume_device;
    
#1 lore raw

Hi!

Quoted 1 line

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

Ok, applied to my tree, will eventually propagate it. (I hope it looks okay to you, rafael).

Quoted 13 lines

diff -pruN 2.6.11-mm4/include/linux/suspend.h 2.6.11-mm4-cy/include/linux/suspend.h

include/linux/suspend.h +1 -1
@@ -34,7 +34,7 @@ typedef struct pbe {
 #define SWAP_FILENAME_MAXLENGTH	32
 
 
-#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
+#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe)+PAGE_SIZE-1)/PAGE_SIZE)
 
 extern dev_t swsusp_resume_device;
 
Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#2 lore raw

Hi,

Quoted 7 lines · Pavel Machek

Hi!

Quoted 1 line

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

Ok, applied to my tree, will eventually propagate it. (I hope it looks okay to you, rafael).

SUSPEND_PD_PAGES is not necessary in swsusp any more. :-) We can just drop it, together with the pagedir_order variable, which is not used. I'll send a patch later today.

BTW, I'm going to post some clean ups for swsusp.c, but I'd like the last changes to settle down in mainline before, if you don't mind.

Greets,
Rafael

Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
#3 lore raw
Quoted 6 lines · Rafael J. Wysocki

Hi,

Quoted 3 lines · Pavel Machek

Hi!

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

Ok, applied to my tree, will eventually propagate it. (I hope it looks okay to you, rafael).

SUSPEND_PD_PAGES is not necessary in swsusp any more. :-) We can just drop it, together with the pagedir_order variable, which is not used. I'll send a patch later today.

The patch follows.

Greets,
Rafael

include/linux/suspend.h +0 -2
diff -Nrup linux-2.6.12-rc1/include/linux/suspend.h linux-2.6.12-rc1-a/include/linux/suspend.h
@@ -34,8 +34,6 @@ typedef struct pbe {
 #define SWAP_FILENAME_MAXLENGTH	32
 
 
-#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
-
 extern dev_t swsusp_resume_device;
    
 /* mm/vmscan.c */
kernel/power/swsusp.c +0 -2
diff -Nrup linux-2.6.12-rc1/kernel/power/swsusp.c linux-2.6.12-rc1-a/kernel/power/swsusp.c
@@ -98,7 +98,6 @@ unsigned int nr_copy_pages __nosavedata 
  */
 suspend_pagedir_t *pagedir_nosave __nosavedata = NULL;
 static suspend_pagedir_t *pagedir_save;
-static int pagedir_order __nosavedata = 0;
 
 #define SWSUSP_SIG	"S1SUSPEND"
 
@@ -1219,7 +1218,6 @@ static int check_header(void)
 		return -EPERM;
 	}
 	nr_copy_pages = swsusp_info.image_pages;
-	pagedir_order = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages));
 	return error;
 }
 
Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
Applied
#4 lore raw

Hi!

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

Ok, applied to my tree, will eventually propagate it. (I hope it looks okay to you, rafael).

SUSPEND_PD_PAGES is not necessary in swsusp any more. :-) We can just drop it, together with the pagedir_order variable, which is not used. I'll send a patch later today.

The patch follows.

Applied to my tree, will propagate.
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#5 lore raw
In reply to Pavel Machek
Quoted 5 lines · Pavel Machek

Hi!

Quoted 1 line

This fixes SUSPEND_PD_PAGES, which wastes one page under most cases.

-This fixes SUSPEND_PD_PAGES, which wastes one page under most cases. +This fixes SUSPEND_PD_PAGES, which, in rare instances, would waste a signle page.

I see rafael is going to drop it. Anyway, my description was wrong.

Coywolf

Quoted 21 lines

Ok, applied to my tree, will eventually propagate it. (I hope it looks okay to you, rafael).

Quoted 13 lines

diff -pruN 2.6.11-mm4/include/linux/suspend.h 2.6.11-mm4-cy/include/linux/suspend.h

include/linux/suspend.h +1 -1
@@ -34,7 +34,7 @@ typedef struct pbe {
 #define SWAP_FILENAME_MAXLENGTH	32
 
 
-#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
+#define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe)+PAGE_SIZE-1)/PAGE_SIZE)
 
 extern dev_t swsusp_resume_device;