Skip to contentSkip to conversation

peeling off zone from physical memory layout [9/10] remove zone_start_pfn from page_alloc.c

RFC New KAMEZAWA Hiroyuki 1 participant 1 message Feb 3, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 peeling off zone from physical memory layout [9/10] remove zone_start_pfn from page_alloc.c

This patch removes zone_start_pfn, spanned_pages from mm/page_alloc.c.

include/linux/mmzone.h +0 -13
Index: hogehoge/include/linux/mmzone.h
===================================================================
@@ -212,20 +212,7 @@ struct zone {
 	 * Discontig memory support fields.
 	 */
 	struct pglist_data	*zone_pgdat;
-	/* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
-	unsigned long		zone_start_pfn;
 
-	/*
-	 * zone_start_pfn, spanned_pages and present_pages are all
-	 * protected by span_seqlock.  It is a seqlock because it has
-	 * to be read outside of zone->lock, and it is done in the main
-	 * allocator path.  But, it is written quite infrequently.
-	 *
-	 * The lock is declared along with zone->lock because it is
-	 * frequently read in proximity to zone->lock.  It's good to
-	 * give them a chance of being in the same cacheline.
-	 */
-	unsigned long		spanned_pages;	/* total size, including holes */
 	unsigned long		present_pages;	/* amount of memory (excluding holes) */
 
 	/*
mm/page_alloc.c +5 -24
Index: hogehoge/mm/page_alloc.c
===================================================================
@@ -89,19 +89,7 @@ unsigned long __initdata nr_all_pages;
 #ifdef CONFIG_DEBUG_VM
 static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
 {
-	int ret = 0;
-	unsigned seq;
-	unsigned long pfn = page_to_pfn(page);
-
-	do {
-		seq = zone_span_seqbegin(zone);
-		if (pfn >= zone->zone_start_pfn + zone->spanned_pages)
-			ret = 1;
-		else if (pfn < zone->zone_start_pfn)
-			ret = 1;
-	} while (zone_span_seqretry(zone, seq));
-
-	return ret;
+	return page_zone(page) != zone;
 }
 
 static int page_is_consistent(struct zone *zone, struct page *page)
@@ -649,7 +637,7 @@ void mark_free_pages(struct zone *zone)
 	int order;
 	struct list_head *curr;
 
-	if (!zone->spanned_pages)
+	if (!populated_zone(zone))
 		return;
 
 	spin_lock_irqsave(&zone->lock, flags);
@@ -2012,11 +2000,9 @@ static __meminit void init_currently_emp
 	zone_wait_table_init(zone, size);
 	pgdat->nr_zones = zone_idx(zone) + 1;
 
-	zone->zone_start_pfn = zone_start_pfn;
-
 	memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);
 
-	zone_init_free_lists(pgdat, zone, zone->spanned_pages);
+	zone_init_free_lists(pgdat, zone, size);
 	arch_register_memory_zone(zone, zone_start_pfn, size);
 }
 
@@ -2052,7 +2038,6 @@ static void __init free_area_init_core(s
 			nr_kernel_pages += realsize;
 		nr_all_pages += realsize;
 
-		zone->spanned_pages = size;
 		zone->present_pages = realsize;
 		zone->name = zone_names[j];
 		spin_lock_init(&zone->lock);
@@ -2219,7 +2204,6 @@ static int zoneinfo_show(struct seq_file
 			   "\n        active   %lu"
 			   "\n        inactive %lu"
 			   "\n        scanned  %lu (a: %lu i: %lu)"
-			   "\n        spanned  %lu"
 			   "\n        present  %lu",
 			   zone->free_pages,
 			   zone->pages_min,
@@ -2229,7 +2213,6 @@ static int zoneinfo_show(struct seq_file
 			   zone->nr_inactive,
 			   zone->pages_scanned,
 			   zone->nr_scan_active, zone->nr_scan_inactive,
-			   zone->spanned_pages,
 			   zone->present_pages);
 		seq_printf(m,
 			   "\n        protection: (%lu",
@@ -2280,12 +2263,10 @@ static int zoneinfo_show(struct seq_file
 		seq_printf(m,
 			   "\n  all_unreclaimable: %u"
 			   "\n  prev_priority:     %i"
-			   "\n  temp_priority:     %i"
-			   "\n  start_pfn:         %lu",
+			   "\n  temp_priority:     %i",
 			   zone->all_unreclaimable,
 			   zone->prev_priority,
-			   zone->temp_priority,
-			   zone->zone_start_pfn);
+			   zone->temp_priority);
 		spin_unlock_irqrestore(&zone->lock, flags);
 		seq_putc(m, '\n');
 	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>