patch-2.4.14 linux/mm/page_alloc.c

Next file: linux/mm/page_io.c
Previous file: linux/mm/oom_kill.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.13/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -80,8 +80,6 @@
 		BUG();
 	if (PageLocked(page))
 		BUG();
-	if (PageDecrAfter(page))
-		BUG();
 	if (PageActive(page))
 		BUG();
 	if (PageInactive(page))
@@ -139,14 +137,10 @@
 	return;
 
  local_freelist:
-	/*
-	 * This is a little subtle: if the allocation order
-	 * wanted is major than zero we'd better take all the pages
-	 * local since we must deal with fragmentation too and we
-	 * can't rely on the nr_local_pages information.
-	 */
-	if (current->nr_local_pages && !current->allocation_order)
+	if (current->nr_local_pages)
 		goto back_local_freelist;
+	if (in_interrupt())
+		goto back_local_freelist;		
 
 	list_add(&page->list, &current->local_pages);
 	page->index = order;
@@ -274,8 +268,6 @@
 						BUG();
 					if (PageLocked(page))
 						BUG();
-					if (PageDecrAfter(page))
-						BUG();
 					if (PageActive(page))
 						BUG();
 					if (PageInactive(page))
@@ -358,7 +350,7 @@
 	/* here we're in the low on memory slow path */
 
 rebalance:
-	if (current->flags & PF_MEMALLOC) {
+	if (current->flags & (PF_MEMALLOC | PF_MEMDIE)) {
 		zone = zonelist->zones;
 		for (;;) {
 			zone_t *z = *(zone++);
@@ -394,7 +386,7 @@
 	}
 
 	/* Don't let big-order allocations loop */
-	if (order > 1)
+	if (order > 3)
 		return NULL;
 
 	/* Yield for kswapd, and try again */
@@ -430,6 +422,15 @@
 	return 0;
 }
 
+void page_cache_release(struct page *page)
+{
+	if (!PageReserved(page) && put_page_testzero(page)) {
+		if (PageActive(page) || PageInactive(page))
+			lru_cache_del(page);
+		__free_pages_ok(page, 0);
+	}
+}
+
 void __free_pages(struct page *page, unsigned int order)
 {
 	if (!PageReserved(page) && put_page_testzero(page))
@@ -514,14 +515,14 @@
 	pg_data_t *tmpdat = pgdat;
 
 	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()));
 
 	while (tmpdat) {
 		zone_t *zone;
 		for (zone = tmpdat->node_zones;
 			       	zone < tmpdat->node_zones + MAX_NR_ZONES; zone++)
-			printk("Zone:%s freepages:%6lukB min:%6luKB low:%6lukB " 
+			printk("Zone:%s freepages:%6lukB min:%6lukB low:%6lukB " 
 				       "high:%6lukB\n", 
 					zone->name,
 					K(zone->free_pages),
@@ -532,10 +533,6 @@
 		tmpdat = tmpdat->node_next;
 	}
 
-	printk("Free pages:      %6dkB (%6dkB HighMem)\n",
-		K(nr_free_pages()),
-		K(nr_free_highpages()));
-
 	printk("( Active: %d, inactive: %d, free: %d )\n",
 	       nr_active_pages,
 	       nr_inactive_pages,
@@ -560,8 +557,7 @@
 					nr++;
 				}
 				total += nr * (1 << order);
-				printk("%lu*%lukB ", nr,
-						(PAGE_SIZE>>10) << order);
+				printk("%lu*%lukB ", nr, K(1UL) << order);
 			}
 			spin_unlock_irqrestore(&zone->lock, flags);
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)