patch-2.4.11-dontuse linux/mm/memory.c
Next file: linux/mm/mmap.c
Previous file: linux/mm/filemap.c
Back to the patch index
Back to the overall index
- Lines: 39
- Date:
Thu Sep 27 08:41:16 2001
- Orig file:
v2.4.10/linux/mm/memory.c
- Orig date:
Sun Sep 23 11:41:01 2001
diff -u --recursive --new-file v2.4.10/linux/mm/memory.c linux/mm/memory.c
@@ -319,7 +319,9 @@
if (pte_none(pte))
continue;
if (pte_present(pte)) {
- freed ++;
+ struct page *page = pte_page(pte);
+ if (VALID_PAGE(page) && !PageReserved(page))
+ freed ++;
/* This will eventually call __free_pte on the pte. */
tlb_remove_page(tlb, ptep, address + offset);
} else {
@@ -1101,6 +1103,10 @@
return;
}
+/* Swap 80% full? Release the pages as they are paged in.. */
+#define vm_swap_full() \
+ (swapper_space.nrpages*5 > total_swap_pages*4)
+
/*
* We hold the mm semaphore and the page_table_lock on entry and exit.
*/
@@ -1158,10 +1164,12 @@
swap_free(entry);
mark_page_accessed(page);
if (exclusive_swap_page(page)) {
- if (vma->vm_flags & VM_WRITE)
- pte = pte_mkwrite(pte);
- pte = pte_mkdirty(pte);
- delete_from_swap_cache(page);
+ if (write_access || vm_swap_full()) {
+ pte = pte_mkdirty(pte);
+ if (vma->vm_flags & VM_WRITE)
+ pte = pte_mkwrite(pte);
+ delete_from_swap_cache(page);
+ }
}
UnlockPage(page);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)