/** * irq_create_affinity_masks - Create affinity masks for multiqueue spreading * @nvecs: The total number of vectors * @affd: Description of the affinity requirements * * Returns the irq_affinity_desc pointer or NULL if allocation failed.
*/ struct irq_affinity_desc *
irq_create_affinity_masks(unsignedint nvecs, struct irq_affinity *affd)
{ unsignedint affvecs, curvec, usedvecs, i; struct irq_affinity_desc *masks = NULL;
/* * Determine the number of vectors which need interrupt affinities * assigned. If the pre/post request exhausts the available vectors * then nothing to do here except for invoking the calc_sets() * callback so the device driver can adjust to the situation.
*/ if (nvecs > affd->pre_vectors + affd->post_vectors)
affvecs = nvecs - affd->pre_vectors - affd->post_vectors; else
affvecs = 0;
/* * Simple invocations do not provide a calc_sets() callback. Install * the generic one.
*/ if (!affd->calc_sets)
affd->calc_sets = default_calc_sets;
/* Recalculate the sets */
affd->calc_sets(affd, affvecs);
if (WARN_ON_ONCE(affd->nr_sets > IRQ_AFFINITY_MAX_SETS)) return NULL;
/* Nothing to assign? */ if (!affvecs) return NULL;
masks = kcalloc(nvecs, sizeof(*masks), GFP_KERNEL); if (!masks) return NULL;
/* Fill out vectors at the beginning that don't need affinity */ for (curvec = 0; curvec < affd->pre_vectors; curvec++)
cpumask_copy(&masks[curvec].mask, irq_default_affinity);
/* * Spread on present CPUs starting from affd->pre_vectors. If we * have multiple sets, build each sets affinity mask separately.
*/ for (i = 0, usedvecs = 0; i < affd->nr_sets; i++) { unsignedint nr_masks, this_vecs = affd->set_size[i]; struct cpumask *result = group_cpus_evenly(this_vecs, &nr_masks);
/* Fill out vectors at the end that don't need affinity */ if (usedvecs >= affvecs)
curvec = affd->pre_vectors + affvecs; else
curvec = affd->pre_vectors + usedvecs; for (; curvec < nvecs; curvec++)
cpumask_copy(&masks[curvec].mask, irq_default_affinity);
/* Mark the managed interrupts */ for (i = affd->pre_vectors; i < nvecs - affd->post_vectors; i++)
masks[i].is_managed = 1;
return masks;
}
/** * irq_calc_affinity_vectors - Calculate the optimal number of vectors * @minvec: The minimum number of vectors available * @maxvec: The maximum number of vectors available * @affd: Description of the affinity requirements
*/ unsignedint irq_calc_affinity_vectors(unsignedint minvec, unsignedint maxvec, conststruct irq_affinity *affd)
{ unsignedint resv = affd->pre_vectors + affd->post_vectors; unsignedint set_vecs;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.