patch-2.2.17 linux/mm/filemap.c
Next file: linux/mm/page_alloc.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index
- Lines: 58
- Date:
Mon Sep 4 18:39:28 2000
- Orig file:
v2.2.16/mm/filemap.c
- Orig date:
Mon Sep 4 18:37:10 2000
diff -u --recursive --new-file v2.2.16/mm/filemap.c linux/mm/filemap.c
@@ -141,10 +141,12 @@
unsigned long limit = num_physpages;
struct page * page;
int count;
-
+ int nr_dirty = 0;
+
/* Make sure we scan all pages twice at priority 0. */
count = (limit << 1) >> priority;
+ refresh_clock:
page = mem_map + clock;
do {
int referenced;
@@ -177,8 +179,6 @@
if ((gfp_mask & __GFP_DMA) && !PageDMA(page))
continue;
- count--;
-
/*
* Is it a page swap page? If so, we want to
* drop it if it is no longer used, even if it
@@ -196,10 +196,23 @@
/* Is it a buffer page? */
if (page->buffers) {
+ /*
+ * Wait for async IO to complete
+ * at each 64 buffers
+ */
+
+ int wait = ((gfp_mask & __GFP_IO)
+ && (!(nr_dirty++ % 64)));
+
if (buffer_under_min())
continue;
- if (!try_to_free_buffers(page))
- continue;
+ /*
+ * We can sleep if we need to do some write
+ * throttling.
+ */
+
+ if (!try_to_free_buffers(page, wait))
+ goto refresh_clock;
return 1;
}
@@ -211,7 +224,7 @@
return 1;
}
- } while (count > 0);
+ } while (--count > 0);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)