 /* * Clamp the batch to a 2^n - 1 value. Having a power * of 2 value was found to be more likely to have * suboptimal cache aliasing properties in some cases. * * For example if 2 tasks are alternately allocating * batches of pages, one task can end up with a lot * of pages of one half of the possible page colors * and the other with pages of the other colors. */ batch = (1 << fls(batch + batch/2)) - 1; 
static void __init free_area_init_core(struct pglist_data *pgdat,		unsigned long *zones_size, unsigned long *zholes_size){	unsigned long i, j;	const unsigned long zone_required_alignment = 1UL << (MAX_ORDER-1);	int cpu, nid = pgdat->node_id;	unsigned long zone_start_pfn = pgdat->node_start_pfn;	pgdat->nr_zones = 0;	init_waitqueue_head(&pgdat->kswapd_wait);	pgdat->kswapd_max_order = 0;		for (j = 0; j < MAX_NR_ZONES; j++) {		struct zone *zone = pgdat->node_zones + j;		unsigned long size, realsize;		unsigned long batch;		zone_table[NODEZONE(nid, j)] = zone;		realsize = size = zones_size[j];		if (zholes_size)			realsize -= zholes_size[j];		if (j == ZONE_DMA || j == ZONE_NORMAL)			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);		spin_lock_init(&zone->lru_lock);		zone->zone_pgdat = pgdat;		zone->free_pages = 0;		zone->temp_priority = zone->prev_priority = DEF_PRIORITY;		/*		 * The per-cpu-pages pools are set to around 1000th of the		 * size of the zone.  But no more than 1/4 of a meg - there's		 * no point in going beyond the size of L2 cache.		 *		 * OK, so we don't know how big the cache is.  So guess.		 */		batch = zone->present_pages / 1024;		if (batch * PAGE_SIZE > 256 * 1024)			batch = (256 * 1024) / PAGE_SIZE;		batch /= 4;		/* We effectively *= 4 below */		if (batch < 1)			batch = 1;		for (cpu = 0; cpu < NR_CPUS; cpu++) {			struct per_cpu_pages *pcp;			pcp = &zone->pageset[cpu].pcp[0];	/* hot */			pcp->count = 0;			pcp->low = 2 * batch;			pcp->high = 6 * batch;			pcp->batch = 1 * batch;			INIT_LIST_HEAD(&pcp->list);			pcp = &zone->pageset[cpu].pcp[1];	/* cold */			pcp->count = 0;			pcp->low = 0;			pcp->high = 2 * batch;			pcp->batch = 1 * batch;			INIT_LIST_HEAD(&pcp->list);		}		printk(KERN_DEBUG "  %s zone: %lu pages, LIFO batch:%lu\n",				zone_names[j], realsize, batch);		INIT_LIST_HEAD(&zone->active_list);		INIT_LIST_HEAD(&zone->inactive_list);		zone->nr_scan_active = 0;		zone->nr_scan_inactive = 0;		zone->nr_active = 0;		zone->nr_inactive = 0;		if (!size)			continue;		/*		 * The per-page waitqueue mechanism uses hashed waitqueues		 * per zone.		 */		zone->wait_table_size = wait_table_size(size);		zone->wait_table_bits =			wait_table_bits(zone->wait_table_size);		zone->wait_table = (wait_queue_head_t *)			alloc_bootmem_node(pgdat, zone->wait_table_size						* sizeof(wait_queue_head_t));		for(i = 0; i < zone->wait_table_size; ++i)			init_waitqueue_head(zone->wait_table + i);		pgdat->nr_zones = j+1;		zone->zone_mem_map = pfn_to_page(zone_start_pfn);		zone->zone_start_pfn = zone_start_pfn;		if ((zone_start_pfn) & (zone_required_alignment-1))			printk(KERN_CRIT "BUG: wrong zone alignment, it will crash\n");		memmap_init(size, nid, j, zone_start_pfn);		zone_start_pfn += size;		zone_init_free_lists(pgdat, zone, zone->spanned_pages);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8e30f272a93ec9c1d5c305c5040dfaebc880499d/page_alloc.c/buggy/mm/page_alloc.c