patch-2.2.0-pre9 linux/mm/vmscan.c
Next file: linux/net/ipv4/ip_output.c
Previous file: linux/mm/swapfile.c
Back to the patch index
Back to the overall index
- Lines: 75
- Date:
Wed Jan 20 16:27:39 1999
- Orig file:
v2.2.0-pre8/linux/mm/vmscan.c
- Orig date:
Tue Jan 19 11:32:53 1999
diff -u --recursive --new-file v2.2.0-pre8/linux/mm/vmscan.c linux/mm/vmscan.c
@@ -407,12 +407,7 @@
current->session = 1;
current->pgrp = 1;
strcpy(current->comm, "kswapd");
-
- /*
- * Hey, if somebody wants to kill us, be our guest.
- * Don't come running to mama if things don't work.
- */
- siginitsetinv(¤t->blocked, sigmask(SIGKILL));
+ sigfillset(¤t->blocked);
/*
* Tell the memory management that we're a "memory allocator",
@@ -429,23 +424,29 @@
current->flags |= PF_MEMALLOC;
while (1) {
- if (signal_pending(current))
- break;
- current->state = TASK_INTERRUPTIBLE;
- run_task_queue(&tq_disk);
- schedule_timeout(HZ);
+ int tmo;
/*
- * kswapd isn't even meant to keep up with anything,
- * so just a few pages per second is plenty: the only
- * point is to make sure that the system doesn't stay
- * forever in a really bad memory squeeze.
+ * Wake up once a second to see if we need to make
+ * more memory available. When we get into a low
+ * memory situation, we start waking up more often.
+ *
+ * We consider "freepages.low" to be low on memory,
+ * but we also try to be aggressive if other processes
+ * are low on memory and would otherwise block when
+ * calling __get_free_page().
*/
- if (nr_free_pages < freepages.high)
- try_to_free_pages(GFP_KSWAPD);
+ tmo = HZ;
+ if (nr_free_pages < freepages.high) {
+ if (nr_free_pages < freepages.low || low_on_memory) {
+ if (try_to_free_pages(GFP_KSWAPD))
+ tmo = (HZ+9)/10;
+ }
+ }
+ run_task_queue(&tq_disk);
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout(tmo);
}
-
- return 0;
}
/*
@@ -475,11 +476,13 @@
}
/* Try to get rid of some shared memory pages.. */
- while (shm_swap(priority, gfp_mask)) {
- if (!--count)
- goto done;
+ if (gfp_mask & __GFP_IO) {
+ while (shm_swap(priority, gfp_mask)) {
+ if (!--count)
+ goto done;
+ }
}
-
+
/* Then, try to page stuff out.. */
while (swap_out(priority, gfp_mask)) {
if (!--count)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov