patch-2.4.0-test5 linux/mm/vmscan.c
Next file: linux/net/802/p8022.c
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index
- Lines: 87
- Date:
Tue Jul 18 12:31:33 2000
- Orig file:
v2.4.0-test4/linux/mm/vmscan.c
- Orig date:
Fri Jul 14 12:12:16 2000
diff -u --recursive --new-file v2.4.0-test4/linux/mm/vmscan.c linux/mm/vmscan.c
@@ -440,7 +440,7 @@
}
/*
- * Check if there recently has been memory pressure (zone_wake_kswapd)
+ * Check if all zones have recently had memory_pressure (zone_wake_kswapd)
*/
static inline int keep_kswapd_awake(void)
{
@@ -451,13 +451,13 @@
for(i = 0; i < MAX_NR_ZONES; i++) {
zone_t *zone = pgdat->node_zones+ i;
if (zone->size &&
- zone->zone_wake_kswapd)
- return 1;
+ !zone->zone_wake_kswapd)
+ return 0;
}
pgdat = pgdat->node_next;
} while (pgdat);
- return 0;
+ return 1;
}
/*
@@ -496,9 +496,7 @@
goto done;
}
- /* not (been) low on memory - it is
- * pointless to try to swap out.
- */
+ /* check if mission completed */
if (!keep_kswapd_awake())
goto done;
@@ -548,9 +546,9 @@
if (!--count)
goto done;
}
- /* We return 1 if we are freed some page, or
- * there are no memory pressure remaining */
- return (count != FREE_COUNT || !memory_pressure());
+ /* Return 1 if any page is freed, or
+ * there are no more memory pressure */
+ return (count < FREE_COUNT || !memory_pressure());
done:
return 1;
@@ -596,10 +594,7 @@
for (;;) {
if (!keep_kswapd_awake()) {
- /* wake up regulary to do an early attempt too free
- * pages - pages will not actually be freed.
- */
- interruptible_sleep_on_timeout(&kswapd_wait, HZ);
+ interruptible_sleep_on(&kswapd_wait);
}
do_try_to_free_pages(GFP_KSWAPD);
@@ -631,18 +626,18 @@
retval = do_try_to_free_pages(gfp_mask);
current->flags &= ~PF_MEMALLOC;
}
- else {
- /* make sure kswapd runs */
- if (waitqueue_active(&kswapd_wait))
- wake_up_interruptible(&kswapd_wait);
- }
+
+ /* someone needed memory that kswapd had not provided
+ * make sure kswapd runs, should not happen often */
+ if (waitqueue_active(&kswapd_wait))
+ wake_up_interruptible(&kswapd_wait);
return retval;
}
static int __init kswapd_init(void)
{
- printk("Starting kswapd v1.6\n");
+ printk("Starting kswapd v1.7\n");
swap_setup();
kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
return 0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)