Re: New Software Suspend Patch for testing.

From: Pavel Machek (pavel@ucw.cz)
Date: Fri Apr 04 2003 - 18:00:47 EST


Hi!

> The changes from the last version are not huge; perhaps most significant
> is that the dynamically allocated bitmaps (in place of pageflags) are
> implemented. This won't mean anything to most people, but Andrew
> Morton,

@@ -536,6 +519,9 @@
         struct page *page;
         int i;
         int cold;
+#if CONFIG_SOFTWARE_SUSPEND
+ static unsigned int loopcount;
+#endif
 
         if (wait)
                 might_sleep();
@@ -589,7 +575,23 @@
 
         /* here we're in the low on memory slow path */
 
+#if CONFIG_SOFTWARE_SUSPEND
+ loopcount=0;
+#endif
 rebalance:
+#ifdef CONFIG_SOFTWARE_SUSPEND
+ if(gfp_mask & __GFP_FAST) {
+/* when using memeat, we ask for all pages that are really free.
+ 5 calls to reschedule should be sufficient to recall all of them since
+ when a page can be found, it is after only one reschedule.
+ Actually I consider this as a bug of alloc_pages, since allocating a
+ page should not hang in an endless loop when it is clear that no
+ memory is available (cbd) */
+ loopcount++;
+ if(loopcount > 5)
+ return NULL;
+ }
+#endif
         if ((current->flags & (PF_MEMALLOC | PF_MEMDIE)) && !in_interrupt()) {
                 /* go through the zonelist yet again, ignoring mins */
                 for (i = 0; zones[i] != NULL; i++) {

Again this is *really really* ugly. Why do you need it? 2.5. has
special function for freeing memory.

                                                        Pavel

-- 
When do you have heart between your knees?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 07 2003 - 22:00:24 EST