Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.11 /mm/memory.c

Filename:/mm/memory.c
Lines Added:13
Lines Deleted:5
Also changed in: (Previous) 2.4.11-pre6  2.4.11-pre5  2.4.11-pre4  2.4.11-pre3  2.4.11-pre2  2.4.11-pre1 
(Following) 2.4.12-ac1  2.4.12-ac2  2.4.12-ac3  2.4.12-ac4  2.4.12-ac5  2.4.12-ac6 

Location
[  2.4.11
  [  mm
     o  memory.c

Patch

diff -u --recursive --new-file v2.4.10/linux/mm/memory.c linux/mm/memory.c
--- v2.4.10/linux/mm/memory.c   Sun Sep 23 11:41:01 2001
+++ linux/mm/memory.c   Thu Sep 27 08:41:16 2001
@@ -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);
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.