Skip to contentSkip to conversation

PATCH: 2.5.66 incremental (#4: Discontiguous patches & Dynamic PageFlag Bitmap)

PATCH Nigel Cunningham 2 participants 3 messages Apr 7, 2003

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

Hi.

This is pretty much the same as the original discontiguous pagedirs patch that you've already seen, except that instead of using real pageflags, bitmaps are made on the fly and discarded (as previously discussed). I've left the NoSave flag as a real pageflag so that drivers etc can mark pages Nosave if need be (is this a real possibility?).

Regards,

Nigel

arch/i386/kernel/swsusp.c +3 -3
diff -ruN linux-2.5.66-inc03/arch/i386/kernel/swsusp.c linux-2.5.66-inc04/arch/i386/kernel/swsusp.c
@@ -210,7 +210,7 @@
 /* Local variables for do_magic */
 static int loop __nosavedata = 0;
 static int loop2 __nosavedata = 0;
-extern suspend_pagedir_t *pagedir_nosave __nosavedata;
+extern suspend_pagedir_t **pagedir_nosave __nosavedata;
 
 /*
  * FIXME: This function should really be written in assembly. Actually
@@ -256,8 +256,8 @@
 	for (loop=0; loop < nr_copy_pages; loop++) {
 		/* You may not call something (like copy_page) here: see above */
 		for (loop2=0; loop2 < (PAGE_SIZE / sizeof(unsigned long)); loop2++) {
-			*(((unsigned long *)((pagedir_nosave+loop)->orig_address))+loop2) =
-				*(((unsigned long *)((pagedir_nosave+loop)->address))+loop2);
+			*(((unsigned long *)(PAGEDIR_ENTRY(pagedir_nosave, loop)->orig_address))+loop2) =
+				*(((unsigned long *)(PAGEDIR_ENTRY(pagedir_nosave, loop)->address))+loop2);
 			__flush_tlb();
 		}
 		
include/linux/suspend.h +4 -2
diff -ruN linux-2.5.66-inc03/include/linux/suspend.h linux-2.5.66-inc04/include/linux/suspend.h
@@ -34,7 +34,7 @@
 	char version[20];
 	int num_cpus;
 	int page_size;
-	suspend_pagedir_t *suspend_pagedir;
+	suspend_pagedir_t **suspend_pagedir;
 	unsigned int num_pbes;
 	struct swap_location {
 		char filename[SWAP_FILENAME_MAXLENGTH];
@@ -42,6 +42,8 @@
 };
 
 #define SUSPEND_PD_PAGES(x)     (((x)*sizeof(struct pbe))/PAGE_SIZE+1)
+#define PAGEDIR_CAPACITY(x)     (((x)*PAGE_SIZE/sizeof(struct pbe)))
+#define PAGEDIR_ENTRY(pagedir, i) (pagedir[i/PAGEDIR_CAPACITY(1)] + (i%PAGEDIR_CAPACITY(1)))
    
 /* mm/vmscan.c */
 extern int shrink_mem(void);
@@ -61,7 +63,7 @@
 extern void thaw_processes(void);
 
 extern unsigned int nr_copy_pages __nosavedata;
-extern suspend_pagedir_t *pagedir_nosave __nosavedata;
+extern suspend_pagedir_t **pagedir_nosave __nosavedata;
 
 /* Communication between kernel/suspend.c and arch/i386/suspend.c */
 
kernel/suspend.c +261 -130

554 lines not on this page · raw message

#1 lore raw

Hi!

Quoted 5 lines

This is pretty much the same as the original discontiguous pagedirs patch that you've already seen, except that instead of using real pageflags, bitmaps are made on the fly and discarded (as previously discussed). I've left the NoSave flag as a real pageflag so that drivers etc can mark pages Nosave if need be (is this a real possibility?).

Drivers should never ever need to set themselves nosave....

It contains the same double pointers and the same
hard-limit-on-#pages-to-be-saved.

Can't you solve the problem (too big alocations) without going to the tree? Like linklist of pages containing pointers? Or maybe vmallocing that pgdir so it can be larger?
Pavel

Signature · 2 lines
Horseback riding is like software...
...vgf orggre jura vgf serr.
#2 lore raw
Quoted 1 line · Pavel Machek

Drivers should never ever need to set themselves nosave....

Okay then. I'll make NoSave use the same scheme. I was mostly wondering about shared memory video cards, but in that case it mostly just seems to be a waste of time saving the pages - it doesn't cause problems.

Quoted 2 lines

It contains the same double pointers and the same
hard-limit-on-#pages-to-be-saved.

Sorry. I forgot about addressing that issue. I'll give one of your suggestions a go when I find the time.

Regards,

Nigel

Signature · 6 lines
Nigel Cunningham
495 St Georges Road South, Hastings 4201, New Zealand

Be diligent to present yourself approved to God as a workman who does
not need to be ashamed, handling accurately the word of truth.
	-- 2 Timothy 2:14, NASB.