int i; 
void __devinit arch_init_sched_domains(void){	int i;	cpumask_t cpu_default_map;	/*	 * Setup mask for cpus without special case scheduling requirements.	 * For now this just excludes isolated cpus, but could be used to	 * exclude other special cases in the future.	 */	cpus_complement(cpu_default_map, cpu_isolated_map);	cpus_and(cpu_default_map, cpu_default_map, cpu_online_map);	/*	 * Set up domains. Isolated domains just stay on the dummy domain.	 */	for_each_cpu_mask(i, cpu_default_map) {		int group;		struct sched_domain *sd = NULL, *p;		cpumask_t nodemask = node_to_cpumask(cpu_to_node(i));		cpus_and(nodemask, nodemask, cpu_default_map);#ifdef CONFIG_NUMA		if (num_online_cpus()				> SD_NODES_PER_DOMAIN*cpus_weight(nodemask)) {			sd = &per_cpu(allnodes_domains, i);			*sd = SD_ALLNODES_INIT;			sd->span = cpu_default_map;			group = cpu_to_allnodes_group(i);			sd->groups = &sched_group_allnodes[group];			p = sd;		} else			p = NULL;		sd = &per_cpu(node_domains, i);		*sd = SD_NODE_INIT;		sd->span = sched_domain_node_span(cpu_to_node(i));		sd->parent = p;		cpus_and(sd->span, sd->span, cpu_default_map);#endif		p = sd;		sd = &per_cpu(phys_domains, i);		group = cpu_to_phys_group(i);		*sd = SD_CPU_INIT;		sd->span = nodemask;		sd->parent = p;		sd->groups = &sched_group_phys[group];#ifdef CONFIG_SCHED_SMT		p = sd;		sd = &per_cpu(cpu_domains, i);		group = cpu_to_cpu_group(i);		*sd = SD_SIBLING_INIT;		sd->span = cpu_sibling_map[i];		cpus_and(sd->span, sd->span, cpu_default_map);		sd->parent = p;		sd->groups = &sched_group_cpus[group];#endif	}#ifdef CONFIG_SCHED_SMT	/* Set up CPU (sibling) groups */	for_each_cpu_mask(i, cpu_default_map) {		cpumask_t this_sibling_map = cpu_sibling_map[i];		cpus_and(this_sibling_map, this_sibling_map, cpu_default_map);		if (i != first_cpu(this_sibling_map))			continue;		init_sched_build_groups(sched_group_cpus, this_sibling_map,						&cpu_to_cpu_group);	}#endif	/* Set up physical groups */	for (i = 0; i < MAX_NUMNODES; i++) {		cpumask_t nodemask = node_to_cpumask(i);		cpus_and(nodemask, nodemask, cpu_default_map);		if (cpus_empty(nodemask))			continue;		init_sched_build_groups(sched_group_phys, nodemask,						&cpu_to_phys_group);	}#ifdef CONFIG_NUMA	init_sched_build_groups(sched_group_allnodes, cpu_default_map,				&cpu_to_allnodes_group);	for (i = 0; i < MAX_NUMNODES; i++) {		/* Set up node groups */		struct sched_group *sg, *prev;		cpumask_t nodemask = node_to_cpumask(i);		cpumask_t domainspan;		cpumask_t covered = CPU_MASK_NONE;		int j;		cpus_and(nodemask, nodemask, cpu_default_map);		if (cpus_empty(nodemask))			continue;		domainspan = sched_domain_node_span(i);		cpus_and(domainspan, domainspan, cpu_default_map);		sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL);		sched_group_nodes[i] = sg;		for_each_cpu_mask(j, nodemask) {			struct sched_domain *sd;			sd = &per_cpu(node_domains, j);			sd->groups = sg;			if (sd->groups == NULL) {				/* Turn off balancing if we have no groups */				sd->flags = 0;			}		}		if (!sg) {			printk(KERN_WARNING			"Can not alloc domain group for node %d\n", i);			continue;		}		sg->cpu_power = 0;		sg->cpumask = nodemask;		cpus_or(covered, covered, nodemask);		prev = sg;		for (j = 0; j < MAX_NUMNODES; j++) {			cpumask_t tmp, notcovered;			int n = (i + j) % MAX_NUMNODES;			cpus_complement(notcovered, covered);			cpus_and(tmp, notcovered, cpu_default_map);			cpus_and(tmp, tmp, domainspan);			if (cpus_empty(tmp))				break;			nodemask = node_to_cpumask(n);			cpus_and(tmp, tmp, nodemask);			if (cpus_empty(tmp))				continue;			sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL);			if (!sg) {				printk(KERN_WARNING				"Can not alloc domain group for node %d\n", j);				break;			}			sg->cpu_power = 0;			sg->cpumask = tmp;			cpus_or(covered, covered, tmp);			prev->next = sg;			prev = sg;		}		prev->next = sched_group_nodes[i];	}#endif	/* Calculate CPU power for physical packages and nodes */	for_each_cpu_mask(i, cpu_default_map) {		int power;		struct sched_domain *sd;#ifdef CONFIG_SCHED_SMT		sd = &per_cpu(cpu_domains, i);		power = SCHED_LOAD_SCALE;		sd->groups->cpu_power = power;#endif		sd = &per_cpu(phys_domains, i);		power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *				(cpus_weight(sd->groups->cpumask)-1) / 10;		sd->groups->cpu_power = power;#ifdef CONFIG_NUMA		sd = &per_cpu(allnodes_domains, i);		if (sd->groups) {			power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *				(cpus_weight(sd->groups->cpumask)-1) / 10;			sd->groups->cpu_power = power;		}#endif	}#ifdef CONFIG_NUMA	for (i = 0; i < MAX_NUMNODES; i++) {		struct sched_group *sg = sched_group_nodes[i];		int j;		if (sg == NULL)			continue;next_sg:		for_each_cpu_mask(j, sg->cpumask) {			struct sched_domain *sd;			int power;			sd = &per_cpu(phys_domains, j);			if (j != first_cpu(sd->groups->cpumask)) {				/*				 * Only add "power" once for each				 * physical package.				 */				continue;			}			power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *				(cpus_weight(sd->groups->cpumask)-1) / 10;			sg->cpu_power += power;		}		sg = sg->next;		if (sg != sched_group_nodes[i])			goto next_sg;	}#endif	/* Attach the domains */	for_each_online_cpu(i) {		struct sched_domain *sd;#ifdef CONFIG_SCHED_SMT		sd = &per_cpu(cpu_domains, i);#else		sd = &per_cpu(phys_domains, i);#endif		cpu_attach_domain(sd, i);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/7f1867a5b3dc3034cbea403b229d65eed4a7f62e/domain.c/buggy/arch/ia64/kernel/domain.c