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

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

Kernel v2.4.13 /mm/page_alloc.c

Filename:/mm/page_alloc.c
Lines Added:20
Lines Deleted:19
Also changed in: (Previous) 2.4.13-pre6  2.4.13-pre5  2.4.13-pre4  2.4.12-ac6  2.4.12-ac4  2.4.12-ac5 
(Following) 2.4.13-ac1  2.4.13-ac2  2.4.13-ac3  2.4.13-ac4  2.4.13-ac5  2.4.13-ac6 

Location
[  2.4.13
  [  mm
     o  page_alloc.c

Patch

diff -u --recursive --new-file v2.4.12/linux/mm/page_alloc.c linux/mm/page_alloc.c
--- v2.4.12/linux/mm/page_alloc.c   Tue Oct  9 17:06:53 2001
+++ linux/mm/page_alloc.c   Tue Oct 23 21:40:32 2001
@@ -394,7 +394,7 @@
    }
 
    /* Don't let big-order allocations loop */
-   if (order)
+   if (order > 1)
       return NULL;
 
    /* Yield for kswapd, and try again */
@@ -467,20 +467,23 @@
 {
    pg_data_t *pgdat = pgdat_list;
    unsigned int sum = 0;
-   zonelist_t *zonelist;
-   zone_t **zonep, *zone;
 
    do {
-      zonelist = pgdat->node_zonelists + (GFP_USER & GFP_ZONEMASK);
-      zonep = zonelist->zones;
+      zonelist_t *zonelist = pgdat->node_zonelists + (GFP_USER & GFP_ZONEMASK);
+      zone_t **zonep = zonelist->zones;
+      zone_t *zone;
 
-      for (zone = *zonep++; zone; zone = *zonep++)
-         sum += zone->free_pages;
+      for (zone = *zonep++; zone; zone = *zonep++) {
+         unsigned long size = zone->size;
+         unsigned long high = zone->pages_high;
+         if (size > high)
+            sum += size - high;
+      }
 
       pgdat = pgdat->node_next;
    } while (pgdat);
 
-   return sum + nr_active_pages + nr_inactive_pages;
+   return sum;
 }
 
 #if CONFIG_HIGHMEM
@@ -497,6 +500,8 @@
 }
 #endif
 
+#define K(x) ((x) << (PAGE_SHIFT-10))
+
 /*
  * Show free area list (used inside shift_scroll-lock stuff)
  * We also calculate the percentage fragmentation. We do this by counting the
@@ -519,21 +524,17 @@
          printk("Zone:%s freepages:%6lukB min:%6luKB low:%6lukB " 
                    "high:%6lukB\n", 
                zone->name,
-               (zone->free_pages)
-               << ((PAGE_SHIFT-10)),
-               zone->pages_min
-               << ((PAGE_SHIFT-10)),
-               zone->pages_low
-               << ((PAGE_SHIFT-10)),
-               zone->pages_high
-               << ((PAGE_SHIFT-10)));
+               K(zone->free_pages),
+               K(zone->pages_min),
+               K(zone->pages_low),
+               K(zone->pages_high));
          
       tmpdat = tmpdat->node_next;
    }
 
    printk("Free pages:      %6dkB (%6dkB HighMem)\n",
-      nr_free_pages() << (PAGE_SHIFT-10),
-      nr_free_highpages() << (PAGE_SHIFT-10));
+      K(nr_free_pages()),
+      K(nr_free_highpages()));
 
    printk("( Active: %d, inactive: %d, free: %d )\n",
           nr_active_pages,
@@ -564,7 +565,7 @@
          }
          spin_unlock_irqrestore(&zone->lock, flags);
       }
-      printk("= %lukB)\n", total * (PAGE_SIZE>>10));
+      printk("= %lukB)\n", K(total));
    }
 
 #ifdef SWAP_CACHE_INFO


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