/* If the cpu has siblings, use them first */
siblmsk = topology_sibling_cpumask(cpu); for (sibl = -1; cpus_per_grp > 0; ) {
sibl = cpumask_next(sibl, siblmsk); if (sibl >= nr_cpu_ids) break; if (!cpumask_test_and_clear_cpu(sibl, nmsk)) continue;
cpumask_set_cpu(sibl, irqmsk);
cpus_per_grp--;
}
}
}
static cpumask_var_t *alloc_node_to_cpumask(void)
{
cpumask_var_t *masks; int node;
masks = kcalloc(nr_node_ids, sizeof(cpumask_var_t), GFP_KERNEL); if (!masks) return NULL;
for (node = 0; node < nr_node_ids; node++) { if (!zalloc_cpumask_var(&masks[node], GFP_KERNEL)) goto out_unwind;
}
return masks;
out_unwind: while (--node >= 0)
free_cpumask_var(masks[node]);
kfree(masks); return NULL;
}
staticvoid free_node_to_cpumask(cpumask_var_t *masks)
{ int node;
staticint get_nodes_in_cpumask(cpumask_var_t *node_to_cpumask, conststruct cpumask *mask, nodemask_t *nodemsk)
{ int n, nodes = 0;
/* Calculate the number of nodes in the supplied affinity mask */
for_each_node(n) { if (cpumask_intersects(mask, node_to_cpumask[n])) {
node_set(n, *nodemsk);
nodes++;
}
} return nodes;
}
/* *Ifthenumberofnodesinthemaskisgreaterthanorequalthe *numberofgroupswejustspreadthegroupsacrossthenodes.
*/ if (numgrps <= nodes) {
for_each_node_mask(n, nodemsk) { /* Ensure that only CPUs which are in both masks are set */
cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
cpumask_or(&masks[curgrp], &masks[curgrp], nmsk); if (++curgrp == last_grp)
curgrp = 0;
} return numgrps;
}
node_groups = kcalloc(nr_node_ids, sizeof(struct node_groups),
GFP_KERNEL); if (!node_groups) return -ENOMEM;
/* allocate group number for each node */
alloc_nodes_groups(numgrps, node_to_cpumask, cpu_mask,
nodemsk, nmsk, node_groups); for (i = 0; i < nr_node_ids; i++) { unsignedint ncpus, v; struct node_groups *nv = &node_groups[i];
if (nv->ngroups == UINT_MAX) continue;
/* Get the cpus on this node which are in the mask */
cpumask_and(nmsk, cpu_mask, node_to_cpumask[nv->id]);
ncpus = cpumask_weight(nmsk); if (!ncpus) continue;
masks = kcalloc(numgrps, sizeof(*masks), GFP_KERNEL); if (!masks) return NULL;
/* assign all CPUs(cpu 0) to the 1st group only */
cpumask_copy(&masks[0], cpu_possible_mask);
*nummasks = 1; return masks;
} #endif/* CONFIG_SMP */
EXPORT_SYMBOL_GPL(group_cpus_evenly);
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.13Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-27)
¤
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.