--- linux-orig/mm/filemap.c Wed Sep 11 14:57:19 1996
+++ linux/mm/filemap.c Tue Jun 24 09:25:16 1997
@@ -160,38 +160,41 @@
} while (tmp != bh);
}
+ /* If it has been referenced recently, don't free it */
+ if (clear_bit(PG_referenced, &page->flags))
+ goto next;
+
+ /* Original note: */
/* We can't throw away shared pages, but we do mark
them as referenced. This relies on the fact that
no page is currently in both the page cache and the
buffer cache; we'd have to modify the following
test to allow for that case. */
- switch (page->count) {
- case 1:
- /* If it has been referenced recently, don't free it */
- if (clear_bit(PG_referenced, &page->flags))
- break;
-
- /* is it a page cache page? */
- if (page->inode) {
- remove_page_from_hash_queue(page);
- remove_page_from_inode_queue(page);
- __free_page(page);
- return 1;
- }
+ /* Why shared pages can't be freed? This modification
+ (sorry for the programming style) allows freeing shared
+ page cache pages. Shared buffers are treated as previously,
+ but they are not marked as referenced. Ah, try_to_free_buffer
+ is called with priority passed to current function, not 6
+ in any case.
+ KS */
- /* is it a buffer cache page? */
- if (bh && try_to_free_buffer(bh, &bh, 6))
+ /* is it a buffer cache page? */
+ if (bh) {
+ if (page->count == 1) {
+ if (try_to_free_buffer(bh, &bh, priority))
return 1;
- break;
-
- default:
- /* more than one users: we can't throw it away */
- set_bit(PG_referenced, &page->flags);
- /* fall through */
- case 0:
- /* nothing */
+ }
+ goto next;
+ }
+ /* is it a page cache page? */
+ if (page->inode) {
+ remove_page_from_hash_queue(page);
+ remove_page_from_inode_queue(page);
+ __free_page(page);
+ return 1;
}
+
next:
page++;
clock++;