2.6.10-rc3 swsusp speedups
Hi!
This should fix O(n^2) behaviour in current swsusp, making "it thinks for 2 minutes before saving image" go away. It should not break anything. I'd like as many people as possible test it, because I'll try to push this into 2.6.11....
Apply with -p0, sorry. [How do I generate nicer patch with CVS?]
Pavel
i386/kernel/signal.c +2 -1
@@ -602,7 +602,8 @@if (current->flags &PF_FREEZE ) {refrigerator (0 ); - goto no_signal; +if (!signal_pending (current)) + goto no_signal; }if (!oldset)
i386/kernel/acpi/wakeup.S +2 -2
@@ -278,7 +278,7 @@ movl %edi, saved_context_edi pushfl ; popl saved_context_eflags - movl $ret_point,saved_eip + movl $ret_point, saved_eip ret
@@ -295,7 +295,7 @@ call save_registers pushl $3 call acpi_enter_sleep_state - addl $4,%esp + addl $4, %esp ret .p2align 4,,7 ret_point:
linux/page-flags.h +5 -1
@@ -74,7 +74,7 @@#define PG_swapcache 16/* Swap page: swp_entry_t in private */ #define PG_mappedtodisk 17/* Has blocks allocated on-disk */ #define PG_reclaim 18/* To be reclaimed asap */ - +#define PG_nosave_free 19/* Page is free and should not be written */ /* * Global page accounting. One instance per CPU. Only unsigned longs are
@@ -277,6 +277,10 @@#define ClearPageNosave (page) clear_bit(PG_nosave, &(page)->flags)#define TestClearPageNosave (page) test_and_clear_bit(PG_nosave, &(page)->flags) +#define PageNosaveFree (page) test_bit(PG_nosave_free, &(page)->flags) +#define SetPageNosaveFree (page) set_bit(PG_nosave_free, &(page)->flags) +#define ClearPageNosaveFree (page) clear_bit(PG_nosave_free, &(page)->flags) +#define PageMappedToDisk (page) test_bit(PG_mappedtodisk, &(page)->flags)#define SetPageMappedToDisk (page) set_bit(PG_mappedtodisk, &(page)->flags)#define ClearPageMappedToDisk (page) clear_bit(PG_mappedtodisk, &(page)->flags)
linux/suspend.h +3 -0
@@ -31,6 +31,7 @@/* mm/page_alloc.c */ extern void drain_local_pages (void ); +extern void mark_free_pages (struct zone *zone);/* kernel/power/swsusp.c */ extern int software_suspend (void );
@@ -54,6 +55,8 @@#else static inline void refrigerator (unsigned long flag) {} +static inline int freeze_processes (void ) {BUG (); } +static inline void thaw_processes (void ) {}#endif /* CONFIG_PM */ #ifdef CONFIG_SMP
signal.c +1 -2
@@ -1442,8 +1442,7 @@unsigned long flags;struct sighand_struct *psig; -if (sig ==-1 ) -BUG (); +BUG_ON (sig ==-1 );/* do_notify_parent_cldstop should have been called instead. */ BUG_ON (tsk->state & (TASK_STOPPED |TASK_TRACED ));
sys.c +3 -0
@@ -401,6 +401,7 @@case LINUX_REBOOT_CMD_HALT :notifier_call_chain (&reboot_notifier_list,SYS_HALT ,NULL ); system_state =SYSTEM_HALT ; +device_suspend (3 );device_shutdown ();printk (KERN_EMERG "System halted.\n" );machine_halt ();
@@ -411,6 +412,7 @@case LINUX_REBOOT_CMD_POWER_OFF :notifier_call_chain (&reboot_notifier_list,SYS_POWER_OFF ,NULL ); system_state =SYSTEM_POWER_OFF ; +device_suspend (3 );device_shutdown ();printk (KERN_EMERG "Power down.\n" );machine_power_off ();
@@ -427,6 +429,7 @@notifier_call_chain (&reboot_notifier_list,SYS_RESTART , buffer); system_state =SYSTEM_RESTART ; +device_suspend (3 );device_shutdown ();printk (KERN_EMERG "Restarting system with command '%s'.\n" , buffer);machine_restart (buffer);
power/disk.c +1 -1
@@ -43,7 +43,7 @@* there ain't no turning back. */ -static void power_down (u32 mode) +static void power_down (suspend_disk_method_t mode) {unsigned long flags;int error =0 ;
power/main.c +10 -5
@@ -65,7 +65,11 @@ goto Thaw; } -if ((error =device_suspend (state))) +/* FIXME: this is suspend confusion biting us. If we pass +state, we'll pass 2 in suspend-to-RAM case; EHCI will +actually break suspend, because it interprets 2 as PCI_D2 +state. Oops. */ +if ((error =device_suspend (3 ))) goto Finish;return 0 ; Finish:
@@ -78,13 +82,14 @@ } -static int suspend_enter (u32 state) +static int suspend_enter (suspend_state_t state) {int error =0 ;unsigned long flags;local_irq_save (flags); -if ((error =device_power_down (state))) +/* FIXME: see suspend_prepare */ +if ((error =device_power_down (3 ))) goto Done; error = pm_ops->enter (state);device_power_up ();
@@ -230,8 +235,8 @@ p =memchr (buf,'\n' , n); len = p ? p - buf : n; -for (s = &pm_states[state]; state <PM_SUSPEND_MAX ; s++, state++) { -if (*s && !strncmp (buf, *s, len)) +for (s = &pm_states[state]; *s; s++, state++) { +if (!strncmp (buf, *s, len))break ; }if (*s)
power/swsusp.c +70 -92
300 lines not on this page · raw message
page_alloc.c +18 -14
@@ -437,26 +437,30 @@#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_PM -int is_head_of_free_region (struct page *page) + +void mark_free_pages (struct zone *zone) { -struct zone *zone =page_zone (page); -unsigned long flags; +unsigned long zone_pfn, flags;int order;struct list_head *curr; -/* -* Should not matter as we need quiescent system for -* suspend anyway, but... -*/ +if (!zone->spanned_pages) +return ; +spin_lock_irqsave (&zone->lock, flags); +for (zone_pfn =0 ; zone_pfn < zone->spanned_pages; ++zone_pfn) +ClearPageNosaveFree (pfn_to_page (zone_pfn + zone->zone_start_pfn)); +for (order =MAX_ORDER -1 ; order >=0 ; --order) -list_for_each (curr, &zone->free_area[order].free_list) - if (page == list_entry(curr, struct page, lru)) { -spin_unlock_irqrestore (&zone->lock, flags); -return 1 << order; - } +list_for_each (curr, &zone->free_area[order].free_list) { +unsigned long start_pfn, i; + + start_pfn = page_to_pfn(list_entry(curr, struct page, lru)); + +for (i=0 ; i < (1 <<order); i++) +SetPageNosaveFree (pfn_to_page (start_pfn+i)); + }spin_unlock_irqrestore (&zone->lock, flags); -return 0 ; }/*
@@ -1581,7 +1585,7 @@ zone->zone_start_pfn = zone_start_pfn;if ((zone_start_pfn) & (zone_required_alignment-1 )) -printk ("BUG: wrong zone alignment, it will crash\n" ); +printk (KERN_CRIT "BUG: wrong zone alignment, it will crash\n" );memmap_init (size, nid, j, zone_start_pfn);
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!