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

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

Kernel v2.1.100 /mm/page_alloc.c

Filename:/mm/page_alloc.c
Lines Added:10
Lines Deleted:9
Also changed in: (Previous) 2.1.99  2.1.98  2.1.93  2.1.92  2.1.91  2.1.90 
(Following) 2.1.101  2.1.107  2.1.109  2.1.110  2.1.116  2.1.118 

Location
[  2.1.100
  [  mm
     o  page_alloc.c

Patch

diff -u --recursive --new-file v2.1.99/linux/mm/page_alloc.c linux/mm/page_alloc.c
--- v2.1.99/linux/mm/page_alloc.c   Sat May  2 14:19:54 1998
+++ linux/mm/page_alloc.c   Wed May  6 14:42:54 1998
@@ -98,9 +98,7 @@
  *
  * Hint: -mask = 1+~mask
  */
-#ifdef __SMP__
-static spinlock_t page_alloc_lock;
-#endif
+static spinlock_t page_alloc_lock = SPIN_LOCK_UNLOCKED;
 
 /*
  * This routine is used by the kernel swap deamon to determine
@@ -125,7 +123,7 @@
     * free unfragmented memory.
     * Added low/high water marks to avoid thrashing -- Rik.
     */
-   if (nr_free_pages > (num_physpages >> 5) + (nr ? 0 : num_physpages >> 6))
+   if (nr_free_pages > (nr ? freepages.low : freepages.high))
       return nr+1;
 
    list = free_area + NR_MEM_LISTS;
@@ -282,7 +280,6 @@
       spin_unlock_irqrestore(&page_alloc_lock, flags);
       if (!(gfp_mask & __GFP_WAIT))
          break;
-      shrink_dcache();
       if (!try_to_free_pages(gfp_mask, SWAP_CLUSTER_MAX))
          break;
       gfp_mask &= ~__GFP_WAIT;   /* go through this only once */
@@ -335,15 +332,19 @@
    int i;
 
    /*
-    * select nr of pages we try to keep free for important stuff
-    * with a minimum of 48 pages. This is totally arbitrary
+    * Select nr of pages we try to keep free for important stuff
+    * with a minimum of 48 pages and a maximum of 256 pages, so
+    * that we don't waste too much memory on large systems.
+    * This is totally arbitrary.
     */
    i = (end_mem - PAGE_OFFSET) >> (PAGE_SHIFT+7);
    if (i < 48)
       i = 48;
+   if (i > 256)
+      i = 256;
    freepages.min = i;
-   freepages.low = i + (i>>1);
-   freepages.high = i + i;
+   freepages.low = i << 1;
+   freepages.high = freepages.low + i;
    mem_map = (mem_map_t *) LONG_ALIGN(start_mem);
    p = mem_map + MAP_NR(end_mem);
    start_mem = LONG_ALIGN((unsigned long) p);


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