Project

General

Profile

Revision c0e4ca98 balance.c

View differences:

balance.c
152 152
}
153 153

  
154 154
/* Find best CPUs for IRQs need to be balanced. */
155
int balance(lub_list_t *cpus, lub_list_t *balance_irqs, float load_limit)
155
int balance(lub_list_t *cpus, lub_list_t *balance_irqs,
156
	float load_limit, cpumask_t *exclude_cpus)
156 157
{
157 158
	lub_list_node_t *iter;
158 159

  
......
160 161
		iter = lub_list_iterator_next(iter)) {
161 162
		irq_t *irq;
162 163
		cpu_t *cpu;
164
		cpumask_t possible_cpus;
165

  
163 166
		irq = (irq_t *)lub_list_node__get_data(iter);
164 167
		/* Try to find local CPU to move IRQ to.
165 168
		   The local CPU is CPU with native NUMA node. */
166
		cpu = choose_cpu(cpus, &(irq->local_cpus), load_limit);
169
		/* Possible CPUs is local CPUs minus exclude-CPUs.
170
		   possible_cpus = local_cpus & ~exclude_cpus */
171
		cpus_init(possible_cpus);
172
		cpus_copy(possible_cpus, *exclude_cpus);
173
		cpus_complement(possible_cpus, possible_cpus);
174
		cpus_and(possible_cpus, possible_cpus, irq->local_cpus);
175
		cpu = choose_cpu(cpus, &possible_cpus, load_limit);
176
		cpus_free(possible_cpus);
167 177
		/* If local CPU is not found then try to use
168 178
		   CPU from another NUMA node. It's better then
169 179
		   overloaded CPUs. */
......
296 306
	unsigned int choose = 0;
297 307
	unsigned int current = 0;
298 308

  
309
	/* Stage 1: Try to move active IRQs from excluded-CPUs */
310

  
311
	/* Stage 2: Move IRQs from overloaded CPUs */
299 312
	/* Search for overloaded CPUs */
300 313
	if (!(overloaded_cpu = most_overloaded_cpu(cpus, threshold)))
301 314
		return 0;

Also available in: Unified diff